Docs

PHP functions

4 min readUpdated November 29, 2026

Integrations#

nbwt_register_integration( $slug, $args )#

Adds a card to WooCommerce > Bricks Templates > Integrations. Registered cards show first.

ArgumentTypeDefaultDescription
$slugstringrequiredUnique slug: lowercase letters, numbers, - and _.
namestringrequiredCard title.
descriptionstring''What the integration does. Plain text.
activebool or callabletrueWhether the plugin it connects to is active. Switches show only while active.
urlstring''Website link.
link_textstring“Visit website”Text for url.
settings_urlstring''Admin link to the other plugin’s settings (shown while active).
settingsarray[]Switches: key => [ 'label' => '', 'help' => '', 'default' => true ].
priorityint10Order on the tab, lower first; then by name.

Returns bool: false when the slug is empty or taken, or name is missing. Switch values are saved under integrations[ $slug ][ $key ] as 1 or 0.

nbwt_integration_on( $slug, $key )#

Whether a switch is on: the saved value, or its default until the site owner saves. false for unknown slugs and keys.

nbwt_integration_active( $slug ) and nbwt_integrations()#

Whether the integration’s active argument is true, and all registered integrations, sorted.

Texts#

nbwt_register_texts( $group, $args )#

Adds a group to Text & translations.

ArgumentTypeDescription
$groupstringUnique group slug. The plugin’s own groups (cart, empty, checkout, help, thankyou, extras, minicart) can’t be used.
labelstringGroup title on the screen.
enarraykey => English text. %s and %d placeholders are fine.
ararraykey => Arabic text.
text_domainstringYour text domain: your .mo files then translate the English texts.

What a shopper sees, first match wins: the site owner’s edit, WPML or Polylang string translation, your Arabic text (or a built-in translation of the same English text), your .mo translation, your English text.

nbwt_text( $group, $key )#

One text in the page’s language, from any group. Returns plain text: escape it where you print it.

echo esc_html( nbwt_text( 'minicart', 'checkout' ) );

Settings#

FunctionReturns
nbwt_settings()The settings, saved values merged with defaults.
nbwt_on( $key )Whether a built-in switch is on, such as mini_cart, co_login, co_coupon, distraction or trust.
nbwt_import_settings( $data )Applies a settings file from Download settings.
nbwt_block_pages()The cart and checkout pages that still use WooCommerce blocks.
nbwt_preview_url( $key ), nbwt_is_preview()The Preview link for cart, checkout or thankyou, and whether the page was opened from one.

Cart#

FunctionReturns
nbwt_cart_item_lock( $key, $item )[ 'remove' => bool, 'qty' => bool, 'child' => bool ].
nbwt_cart_qty_rules( $product, $item, $key )[ 'min', 'max', 'step' ] from woocommerce_quantity_input_args, max 0 for no limit.
nbwt_cart_has_low_stock(), nbwt_low_stock_left( $product )Whether any item is low in stock, and how many are left.
nbwt_wishlist_provider(), nbwt_wishlist_add( $product_id )The Save for later wishlist (yith, ti or empty), and adding to it.
nbwt_convert_price( $amount )A store-currency price in the shopper’s currency.
nbwt_convert_limit( $amount )A store-currency limit in the shopper’s currency (WC Currency Switch).

Orders#

FunctionReturns
nbwt_order_gift( $order )[ 'wrap' => bool, 'msg' => string ], from _nbwt_gift_wrap and _nbwt_gift_message.
nbwt_order_courses( $order )Courses and memberships the order gives (Tutor LMS, LearnDash, LifterLMS).
nbwt_order_memberships( $order ), nbwt_member_url()ARMember plans and BricksMembers levels, and the member area link.
nbwt_optin_providers(), nbwt_optin_on(), nbwt_optin_subscribe( $order )Newsletter plugins, whether the checkbox shows, and adding the customer.

Tracking and address#

FunctionReturns
nbwt_trackers(), nbwt_tracking_on(), nbwt_track_item( $product, $qty, $key )Active tracking plugins, whether events are sent, and item data.
nbwt_address_services(), nbwt_address_service()The address suggestion services and the chosen one.
nbwt_spl_lookup( $code, $lang )Saudi Post lookup for a short address (A Arabic, E English): the parts or a WP_Error.
nbwt_latin_digits( $value )Arabic-Indic and Persian digits turned into 0-9.

Languages#

FunctionReturns
nbwt_is_ar(), nbwt_is_rtl(), nbwt_text_language()The text language (en, ar, fr, …) and whether it is Arabic or right to left.
nbwt_html_lang()The language as an HTML lang value: fr, pt-BR, zh-TW.
nbwt_builtin_languages()Codes with built-in text.
nbwt_text_pack_code( $lang, $locale = null )The built-in text file for a code.
nbwt_ajax_language()The page language during a mini cart request (from the nbwt_lang cookie).
nbwt_plugin_folder_active( $folders )True when a plugin from one of these folders (or its -premium folder) is active.