Introducción
Esta página es para desarrolladores que quieren ajustar o ampliar Tiered Pricing Table for WooCommerce con código: leer y cambiar precios, sobrescribir plantillas, engancharse al JavaScript, usar la API REST y, sobre todo, consultar la lista completa de acciones y filtros. La documentación para propietarios de tiendas está en la Guía del usuario.
Convenciones
El código vive en el espacio de nombres TierPricingTable\ (src/) y las plantillas en views/. Todos los hooks llevan el prefijo tiered_pricing_table/ y usan / como separador, p. ej. tiered_pricing_table/price/pricing_rule. Los ajustes son opciones con el prefijo tier_pricing_table_. La mayoría de los filtros se pueden enganchar desde un tema o un plugin en cualquier momento; los tres filtros de arranque addons/list, integrations/plugins y integrations/themes se ejecutan mientras se incluye el archivo del plugin y deben engancharse desde un plugin de uso obligatorio (must-use) o desde un plugin que se cargue antes que tier-pricing-table.
Precios y reglas
Leer la regla y el precio efectivos
use TierPricingTable\PriceManager;
$rule = PriceManager::getPricingRule( $product_id ); // TierPricingTable\PricingRule — product meta + role/customer/global rules applied
$rule->getRules(); // [ 5 => 9.5, 10 => 8.0 ] (fixed), [ 5 => 10, 10 => 20 ] (percentage) or [ 5 => 1.5, 10 => 3 ] (amount off per unit)
$rule->getType(); // 'fixed' | 'percentage' | 'amount'
$rule->getMinimum(); // ?int
$rule->provider; // 'product' | 'role-based' | 'user-based' | 'global-rules' | …
$rule->providerData; // e.g. [ 'rule_id' => 42, 'applying_type' => 'cross' ] or [ 'role' => 'wholesale' ]
$rule->data; // 'maximum_quantity', 'group_of_quantity', 'tier_labels', …
$rule->pricingData; // base-price overrides: regular_price, sale_price, discount, discount_type, pricing_type, tax_status, tax_class
$unit = $rule->getTierPrice( 12 ); // display price for qty 12 (false if below the first tier)
$unit = $rule->getTierPrice( 12, false, 'cart' ); // raw price, cart context
$has = ! empty( $rule->getRules() );
$has = \TierPricingTable\PricingTable::getInstance()->productHasPricingRules( $product ); // variable products too
Cambiar la regla de cualquier producto
tiered_pricing_table/price/pricing_rule recibe el PricingRule después de leer los metadatos del producto. Los proveedores integrados usan estas prioridades; elija la suya en relación con ellas: límites de cantidad 1, reglas de categoría 10, por rol 20, por cliente 25, reglas globales 30, solicitud de cotización 99, conversión de moneda 9999.
add_filter( 'tiered_pricing_table/price/pricing_rule', function ( \TierPricingTable\PricingRule $rule, int $productId ) {
if ( has_term( 'clearance', 'product_cat', $productId ) ) {
$rule->setType( 'percentage' );
$rule->setRules( [ 3 => 15, 6 => 25 ] ); // 15 % off from 3 units, 25 % from 6
$rule->logPricingModification( 'Clearance tiers applied by my-plugin' ); // shown in Debug mode
}
return $rule;
}, 40, 2 );
Otros filtros útiles: …/price/price_by_rules (precio unitario final para una cantidad), …/price/round_price / …/price/round_precision, …/cart/product_cart_price (precio fijado en un artículo del carrito), …/cart/total_product_count (cantidad usada para elegir el nivel en el carrito), …/cart/need_price_recalculation (omitir un artículo), …/services/regular_pricing/price (precio normal/de oferta ajustado para el usuario actual), …/global_pricing/matched_pricing_rule (qué regla global se aplica).
Escribir reglas por código
| Clave de metadatos (producto / variación) | Valor |
|---|---|
_fixed_price_rules | array<int qty, string price>: p. ej. [5 => '9.50', 10 => '8.00'] |
_percentage_price_rules | array<int qty, string percent> |
_amount_price_rules | array<int qty, string amount>: un importe de descuento sobre el precio del producto por unidad |
_tiered_price_rules_type | fixed | percentage | amount |
_tiered_price_minimum_qty | int > 1 |
_tiered_pricing_maximum_quantity, _tiered_pricing_group_of_quantity | int (maximum, step) |
_tiered_price_mix_and_match_minimum | yes | no (producto principal variable) |
_tiered_pricing_template, _tiered_pricing_base_unit_name | slug del diseño; ['singular' => …, 'plural' => …] |
_{role}_fixed_price_rules, _{role}_percentage_price_rules, _{role}_amount_price_rules, _{role}_tiered_price_rules_type, _{role}_tiered_price_minimum_qty, _{role}_tiered_price_pricing_type, _{role}_tiered_price_regular_price, _{role}_tiered_price_sale_price, _{role}_tiered_price_discount, _{role}_tiered_price_discount_type | reglas por rol ({role} = slug del rol); las reglas por cliente usan _user_{userId}_… |
// Product-level
update_post_meta( 123, '_fixed_price_rules', [ 5 => '9.50', 10 => '8.00' ] );
update_post_meta( 123, '_tiered_price_rules_type', 'fixed' );
\TierPricingTable\PriceManager::updateProductMinimumQuantity( 123, 5 );
// Role-based
\TierPricingTable\Addons\RoleBasedPricing\RoleBasedPricingRule::buildFromArray( 123, 'wholesale', [
'pricing_type' => 'flat', 'regular_price' => 20, 'sale_price' => 18,
'tiered_pricing_type' => 'fixed', 'fixed_tiered_pricing_rules' => [ 10 => 17, 50 => 15 ],
'minimum_order_quantity' => 5,
] )->save();
// Global rule (post type tpt-global-rule)
use TierPricingTable\Addons\GlobalTieredPricing\CPT\GlobalTieredPricingCPT;
use TierPricingTable\Addons\GlobalTieredPricing\GlobalPricingRule;
$ruleId = wp_insert_post( [ 'post_type' => GlobalTieredPricingCPT::SLUG, 'post_status' => 'publish', 'post_title' => 'Wholesale tiers' ] );
$rule = GlobalPricingRule::fromArray( [ 'tiered_pricing_type' => 'fixed', 'fixed_rules' => [ 10 => 9.5, 50 => 8 ], 'minimum' => 5, 'applying_type' => 'individual' ] );
$rule->setId( $ruleId );
$rule->setIncludedProductCategories( [ 15 ] );
$rule->setIncludedUsersRole( [ 'wholesale' ] );
$rule->save();
// Cart rule: a discount on the cart once its subtotal reaches a tier (applied as a virtual coupon)
$orderRuleId = wp_insert_post( [ 'post_type' => GlobalTieredPricingCPT::SLUG, 'post_status' => 'publish', 'post_title' => 'Spend more, save more' ] );
$orderRule = GlobalPricingRule::fromArray( [
'kind' => 'order',
'order_basis' => 'amount', // or 'quantity': the tiers compare with the item count
'order_discount_type' => 'fixed', // an amount off, or 'percentage' (premium)
'order_tiers' => [ [ 'from' => 300, 'discount' => 25 ], [ 'from' => 600, 'discount' => 60 ] ],
'order_label' => 'Order discount {discount}', // placeholders: {discount}, {threshold}
'order_free_shipping' => 'amount', // 'none', 'always', 'amount' or 'quantity'
'order_free_shipping_from' => 500,
'order_shipping_bar' => 'yes', // premium
'order_minimum_amount' => 50, // premium
'priority' => 10,
] );
$orderRule->setId( $orderRuleId );
$orderRule->setIncludedProductCategories( [ 15 ] ); // optional scope: only these lines count and are discounted; none = the whole cart
$orderRule->save();
\TierPricingTable\Core\ServiceContainer::getInstance()->getCache()->purge();
Metadatos de la regla global de una regla de carrito (_tpt_rule_kind = order): _tpt_rule_kind (product \| order), _tpt_order_basis (amount \| quantity: con qué se comparan los niveles), _tpt_order_tiers (filas de from y discount), _tpt_order_discount_type (fixed \| percentage), _tpt_order_label, _tpt_order_free_shipping (none \| always \| amount \| quantity), _tpt_order_free_shipping_from, _tpt_order_shipping_bar (yes \| no), _tpt_order_shipping_bar_message, _tpt_order_shipping_bar_reached, _tpt_order_minimum_amount, _tpt_order_minimum_quantity. fromArray() acepta las mismas claves sin el prefijo _tpt_ (kind, order_basis, order_tiers, order_discount_type, order_label, order_free_shipping, order_free_shipping_from, order_shipping_bar, order_shipping_bar_message, order_shipping_bar_reached, order_minimum_amount, order_minimum_quantity). Al actualizar, OrderDiscounts\MinimumsMigration convierte la tabla de mínimos de las antiguas reglas de carrito por rol en una regla de pedido por rol (la opción tier_pricing_table_order_minimums_migrated lo registra). En el carrito, OrderDiscounts\OrderDiscountResolver::resolve( WC_Cart $cart, ?WP_User $user ) devuelve el OrderDiscount que ha ganado el carrito (regla, nivel, subtotal contado, propiedades del cupón) y nextTier() lo que falta para el siguiente. OrderDiscounts\FreeShippingBar::progress( ?WC_Cart $cart, ?WP_User $user ) devuelve el estado de la barra de envío gratuito (regla, modo, umbral, valor, restante, alcanzado, porcentaje), progressFor( $rule, $counted ) lo mismo a partir de una regla y de las líneas contadas, y render( $context ) el HTML de la barra.
Plantillas
Mostrar la tabla usted mismo
ob_start();
\TierPricingTable\PricingTable::getInstance()->renderPricingTable( $product_id, null, [ 'display' => true, 'display_type' => 'blocks', 'title' => 'Volume pricing' ] );
$html = ob_get_clean();
Claves de ajustes que puede pasar: display_type (table, blocks, options, dropdown, horizontal-table, plain-text, tooltip), title, quantity_column_title, price_column_title, discount_column_title, quantity_type (range \| static), show_discount_column, clickable_rows, active_tier_color, table_style, blocks_style, options_style, compact_layout, options_show_total, options_show_original_product_price, options_show_default_option, options_option_text, plain_text_option_text, update_price_on_product_page, show_total_price, quantity_measurement_singular, quantity_measurement_plural. Las mismas claves funcionan como atributos del shortcode. Use tiered_pricing_table/should_render_pricing_table para suprimir la salida automática y tiered_pricing_table/display_settings para cambiar los ajustes al vuelo.
Sobrescribir plantillas desde un tema
Copie cualquier archivo de la carpeta views/frontend/ del plugin (tiered-pricing-table.php, tiered-pricing-blocks-style-3.php, summary-table.php, …) en **wp-content/themes/{your-theme}/tiered-pricing-table/** y edítelo allí. tiered_pricing_table/template/location permite a un plugin redirigir una plantilla.

Variables en las plantillas de diseño: $pricing_rule (PricingRule), $price_rules, $pricing_type, $minimum, $product, $product_id, $settings, $id.
Respete el contrato del marcado
El JavaScript lee el marcado: conserve el id del elemento raíz, data-product-id, data-price-rules, data-minimum, data-regular-price, data-sale-price, data-price, data-product-price-suffix, un elemento por nivel con data-tiered-quantity / data-tiered-price / data-tiered-price-exclude-taxes / data-tiered-price-include-taxes, la fila base con data-tiered-quantity="{minimum}" y la clase tiered-pricing--active, y las funciones auxiliares tptParseOptionText() / tptParsePlainText().
Inyectar contenido en los diseños
// Extra column in the table layouts
add_action( 'tiered_pricing_table/tiered_pricing/header_columns', fn() => print '<th>Total</th>' );
add_action( 'tiered_pricing_table/tiered_pricing/row_columns', function ( \TierPricingTable\PricingRule $rule, $qty ) {
$qty = $qty ?: max( 1, (int) $rule->getMinimum() ); // null = base row
$price = $rule->getTierPrice( $qty );
echo '<td>' . ( $price ? wc_price( $price * $qty ) : '—' ) . '</td>';
}, 10, 2 );
// Badge next to a tier in every layout
foreach ( [ 'table', 'horizontal-table', 'blocks', 'options', 'dropdown', 'plain-text' ] as $layout ) {
add_action( "tiered_pricing_table/{$layout}/label", function ( $rule, $qty ) {
if ( 50 === (int) $qty ) { echo '<span class="my-badge">Best value</span>'; }
}, 10, 2 );
}
// "100 or more" instead of "100+"
add_filter( 'tiered_pricing_table/tiered_pricing/last_tier_postfix', fn() => ' or more' );
Todos los hooks de diseño aparecen en Hooks de plantilla.
JavaScript
El motor del frontend (tiered-pricing-table-front-js, jQuery) expone document.__tieredPricing:
// Point the plugin at a custom quantity input / price container
document.__tieredPricing = document.__tieredPricing || { overrides: {} };
document.__tieredPricing.overrides.$getQuantityField = ( parentId ) => jQuery( '#my-qty-' + parentId );
document.__tieredPricing.overrides.$getPriceContainer = ( productId, parentId ) => jQuery( '#my-price-' + parentId );
// React to quantity changes
jQuery( document ).on( 'tiered_price_update', '.tpt__tiered-pricing', function ( event, data ) {
// data.quantity, data.price, data.price_excl_tax, data.productId, data.parentId,
// data.pricing = { price, price_excl_tax, price_incl_tax, priceHtml, tieredQuantity, eventQuantity }
} );
// Set the quantity
jQuery( '.quantity-input-product-123' ).val( 10 ).trigger( 'change' );
// Initialise tables inserted after page load (quick view, AJAX)
document.querySelectorAll( '.tpt__tiered-pricing' ).forEach( function ( el ) {
if ( ! el.__tptInit ) { el.__tptInit = true; document.__tieredPricing.initFunction( el ); }
} );
El precio vivo del producto es el HTML de precio de WooCommerce envuelto en <span class="tiered-pricing-dynamic-price-wrapper" data-price-type="dynamic|static|no-rules">; devuelva static desde tiered_pricing_table/frontend/default_price_behaviour_type para conservar el precio de WooCommerce, o false desde …/frontend/wrap_price para omitir el contenedor. Hooks de estilo: .tpt__tiered-pricing, .tiered-pricing--active, .tiered-pricing-table, .tiered-pricing-block, .tiered-pricing-option, .tiered-pricing-dropdown, .tier-pricing-summary-table, .tiered-pricing-you-save, .tiered-pricing-tier-label.
Shortcodes, bloque y widget
| Punto de integración | Detalles |
|---|---|
[tiered-pricing-table] | product_id (la entrada actual por defecto) más cualquier clave de ajustes de Mostrar la tabla usted mismo, p. ej. [tiered-pricing-table product_id="123" display_type="blocks" title="Volume pricing"] |
[tiered_price_you_save] | product_id, color, template, consider_sale_price |
[tiered_pricing_wholesale_registration] | El formulario de solicitud mayorista (8.0.0+). Sin atributos; el formulario, sus campos y sus mensajes vienen de Ajustes → Mayorista. Muestra una nota solo para el gestor de la tienda mientras la función está desactivada. |
[tiered_pricing_free_shipping_bar] | La barra de envío gratuito de la regla de carrito a la que está sujeto el carrito del visitante (8.3.0+, premium). Sin atributos; los mensajes, los colores y la altura vienen de la regla y de la página de ajustes de Reglas de carrito (la sección de ajustes order-rules, que aparece en la navegación solo mientras está abierta). Muestra un div.tpt-free-shipping-bar-live vacío cuando no se aplica ninguna regla con barra; los fragmentos del carrito actualizan cada uno de esos contenedores al añadir al carrito. |
Bloque tiered-pricing-table/free-shipping-bar | La misma barra como bloque (sin atributos; admite alineación y espaciado). |
Bloque tiered-pricing-table/tiered-pricing-block | displayType, title, activeTierColor, showDiscountColumn, títulos de columna |
Widget de Elementor tiered-pricing-table | product_id, display_type, title, active_tier_color, títulos de columna, ajustes de opciones/unidad de medida |
API REST
Los endpoints de producto y variación de WooCommerce (/wp-json/wc/v3/products/{id}, /products/{id}/variations/{vid}) leen y escriben estos campos:
| Campo | Valor |
|---|---|
tiered_pricing_type | fixed | percentage | amount |
tiered_pricing_fixed_rules, tiered_pricing_percentage_rules, tiered_pricing_amount_rules | { "<qty>": <price|percent|amount off> } |
tiered_pricing_minimum_quantity | entero o null |
tiered_pricing_roles_data | { "<role>": { pricing_type, regular_price, sale_price, discount, discount_type, tiered_pricing_type, fixed_rules, percentage_rules, amount_rules, minimum, tax_status, tax_class } }: al escribir se sustituyen todos los datos de rol; envíe los niveles y el mínimo como fixed_tiered_pricing_rules, percentage_tiered_pricing_rules, amount_tiered_pricing_rules, minimum_order_quantity |
tiered_pricing_product_settings | { "layout": "default"|<layout>, "base_unit_name": { "singular", "plural" }, "default_variation": <id> } |
PUT /wp-json/wc/v3/products/123
{
"tiered_pricing_type": "percentage",
"tiered_pricing_percentage_rules": { "10": 5, "50": 12.5 },
"tiered_pricing_minimum_quantity": 5,
"tiered_pricing_roles_data": { "wholesale": { "pricing_type": "percentage", "discount": 15, "tiered_pricing_type": "fixed", "fixed_tiered_pricing_rules": { "10": 7.5 }, "minimum_order_quantity": 4 } }
}
Añada su propio campo ampliando TierPricingTable\Services\API\ProductFields\ProductField y añadiendo la clase con tiered_pricing_table/api/product_fields. Rutas del plugin: tier-pricing-table/v1/quote-request (POST, pública), /quote-forms, /quote-settings, /tax-settings, tier-pricing-table/features/tier-labels/v1/labels, …/custom-columns/v1/columns, …/tools/v1/*. Columnas de importación/exportación CSV de WooCommerce: tiered_price_fixed, tiered_price_percentage (qty:value,…), tiered_price_type, tiered_price_minimum y, por rol, {role}_tiered_price_*.
Ampliar la administración
// A setting in the General tab (option tier_pricing_table_my_hide_for_guests, 'yes' | 'no')
add_filter( 'tiered_pricing_table/settings/general_settings', function ( array $fields ) {
$fields[] = [
'title' => 'Hide table for guests',
'id' => \TierPricingTable\Settings\Settings::SETTINGS_PREFIX . 'my_hide_for_guests',
'type' => \TierPricingTable\Settings\CustomOptions\TPTSwitchOption::FIELD_TYPE,
'default' => 'no',
];
return $fields;
} );
// An integration with its own on/off toggle under Settings → Integrations (boot-time filter)
class My_Integration extends \TierPricingTable\Integrations\Plugins\PluginIntegrationAbstract {
public function getTitle(): string { return 'My Plugin'; }
public function getDescription(): string { return 'Adds option costs to tiered prices.'; }
public function getSlug(): string { return 'my-plugin'; }
public function run() { add_filter( 'tiered_pricing_table/cart/product_cart_price', [ $this, 'addOptionsCost' ], 20, 2 ); }
}
add_filter( 'tiered_pricing_table/integrations/plugins', fn( array $list ) => array_merge( $list, [ My_Integration::class ] ) );
- Pestañas y campos de ajustes:
tiered_pricing_table/settings/sections,…/general_settings,…/general_subsections,…/calculation_logic(grupo Cálculo de precios),…/advanced_settings,…/tools_settings,…/sections_order. Tipos de campo:tpt_switch_option,tpt_display_type,tpt_text_template,tpt_link_button. - Editor de productos: muestre campos en
tiered_pricing_table/admin/pricing_tab_begin|after_minimum_order_quantity_field|advance_product_options|pricing_tab_end($postId;after_minimum_order_quantity_fieldtambién pasa$loopy el prefijo del nombre de campo,'_variable'en la sección Producto variable) y dentro del formulario de reglas (…/admin/tiered_pricing_rules_form/form_begin|inputs|form_end); guarde enwoocommerce_process_product_meta/woocommerce_save_product_variation. Dé nombre a los campos conTierPricingTable\Forms\Form::getFieldName( $base, $role, $loop ). - Reglas por rol / cliente: muestre en
…/admin/role_based_rules/after_tiered_pricing_rules_field(yuser_based_rules), guarde en…/role_based_rules/save_role_based_rules(yuser_based_rules/save_user_based_rules). - Reglas globales: añada una pestaña con
tiered_pricing_table/global_pricing/form_tabs(amplíeCPT\Form\FormTab), guarde en…/global_pricing/before_updating, lea sus metadatos en…/global_pricing/after_built_ruley añada columnas a la lista con…/global_pricing/columns. - Columnas de tabla personalizadas: amplíe
Addons\CustomColumns\Columns\AbstractCustomColumny regístrela contiered_pricing_table/custom_columns/available_columns_types+…/custom_columns/columns_handlers. - Complementos: amplíe
Addons\AbstractAddony añádalo contiered_pricing_table/addons/list(filtro de arranque); obtiene un interruptor en la pestaña Módulos.
Depuración
- Modo de depuración (Ajustes → Módulos → Depuración) muestra la regla resuelta bajo cada artículo del carrito y dentro de la tabla de precios, incluido el registro escrito con
PricingRule::logPricingModification(). - Caché: el HTML de precios del catálogo se guarda en el transient
tpt_product_data; púrguelo desde Ajustes → Módulos → Caché o conServiceContainer::getInstance()->getCache()->purge(). $GLOBALS['tpt_current_user_id']hace que todos los cálculos de precios se ejecuten para ese usuario (los pedidos manuales lo usan).
Referencia de hooks
Cada filtro y acción que lanza el plugin, agrupados por tema. Tipo es F (filtro: devuelva el primer parámetro) o A (acción). Los parámetros se enumeran en orden; el primer parámetro de un filtro es el valor que hay que devolver. Cada fila admite enlace directo (el id de la fila es hook- + el nombre del hook con los caracteres no alfanuméricos sustituidos por -). Todos los nombres llevan el prefijo tiered_pricing_table/ salvo los que se muestran completos.
Arranque y servicios
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tpt_fs_loaded | A | — | SDK de Freemius inicializado (tpt_fs() disponible). |
tiered_pricing_table/ | F | string $className | Nombre de la clase instanciada por ServiceContainer::initService(): devuelva una subclase para sustituir un servicio. |
tiered_pricing_table/ | F | array<string,AbstractAddon> $addons | Instancias de complementos indexadas por clase, antes de run(): añada, quite o sustituya complementos. |
tiered_pricing_table/ | F | string[] $types | Por defecto simple, variation, subscription, subscription-variation. |
tiered_pricing_table/ | F | string[] $types | Por defecto variable, variable-subscription. |
tiered_pricing_table/ | F | string[] $types | Por defecto variation, subscription-variation. |
tiered_pricing_table/ | F | array<string,string> $layouts | Slug del diseño ⇒ etiqueta (table, blocks, options, dropdown, horizontal-table, plain-text, tooltip). |
tiered_pricing_table/ | F | WP_User $user | El usuario para el que se calculan los precios (por defecto: el usuario actual, o $GLOBALS['tpt_current_user_id']). |
tiered_pricing_table/ | F | string[] $roles, int $userId | Roles usados para los precios por rol y las claves de caché; un visitante que no ha iniciado sesión recibe el pseudorrol guest. |
tiered_pricing_table/ | F | string $separator | Separador de las listas qty:price en la importación/exportación CSV (por defecto ,). |
tiered_pricing_table/ | F | string $separator | Separador entre cantidad y precio dentro de una regla en la exportación CSV (por defecto :). Las hojas de cálculo leen 20:100 como una hora; devuelva = para obtener 20=100. El importador acepta :, = y el valor configurado. |
tiered_pricing_table/ | F | string $absolutePath, string $template | Ruta final de cualquier plantilla (frontend/…, admin/…, addons/…). |
tiered_pricing_table/ | A | string $absolutePath, array $variables | Antes de incluir una plantilla. |
tiered_pricing_table/ | A | string $absolutePath, array $variables | Después de incluir una plantilla. |
tiered_pricing_table/ | F | string $url, string $file | URL de un recurso JS del plugin. |
tiered_pricing_table/ | F | string $url, string $file | URL de un recurso CSS del plugin. |
Cálculo de precios
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | PricingRule $rule, int $productId | Punto de extensión principal. La regla efectiva de un producto después de leer los metadatos del producto; los proveedores (categoría 10, rol 20, cliente 25, global 30, cotización 99) la modifican aquí. Se guarda en caché por solicitud. |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Reglas a nivel de producto leídas de los metadatos (solo contexto view). |
tiered_pricing_table/ | F | float|false $price, int $quantity, int $productId, string $context, string $place, PricingRule $rule | Precio unitario final para una cantidad (false = ningún nivel coincidió). |
tiered_pricing_table/ | F | bool $round | Si se redondean los precios de los niveles (por defecto: la opción Redondear precio). |
tiered_pricing_table/ | F | int $decimals | Precisión del redondeo (por defecto max(2, wc_get_price_decimals())). |
tiered_pricing_table/ | F | int $decimals, float $percent, ?WC_Product $product, ?PricingRule $rule | Decimales de los descuentos porcentuales mostrados en todos los diseños y en el marcador {tp_discount} (por defecto 2; devuelva 0 para números enteros como «10 %»). |
tiered_pricing_table/ | F | string $type, int $productId | Tipo de precio a nivel de producto (fixed | percentage | amount). |
tiered_pricing_table/ | F | ?int $minimum, int $productId | Cantidad mínima de pedido a nivel de producto. |
tiered_pricing_table/ | F | bool $enabled | Devuelva true para activar RegularPricingService (filtros de precio de WC). Los complementos de reglas globales, por rol y por cliente lo hacen. |
tiered_pricing_table/ | F | ?float $newPrice, ?WC_Product $product, ?string $specific ('regular'|'sale'|null), $originalPrice | Precio normal/de oferta/actual ajustado para el usuario actual (null conserva el valor de WooCommerce). |
tiered_pricing_table/ | F | bool $override | Si los productos con precio cero tienen su precio sobrescrito (por defecto true). |
tiered_pricing_table/ | F | ?int $value, int $productId, string|false $role | Cantidad máxima de un producto; aquí se aplican los valores específicos de cada rol. |
tiered_pricing_table/ | F | ?int $value, int $productId, string|false $role | Paso de cantidad de un producto. |
tiered_pricing_table/ | F | bool $skip, int $productId, WC_Product $product | Omitir las reglas heredadas a nivel de categoría para un producto. |
tiered_pricing_table/ | F | bool $check, WC_Product $product | Devuelva true para que productHasPricingRules() analice las variaciones en lugar de suponer que un producto variable tiene reglas. |
Carrito y pago
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | bool $recalculate, array $cartItem, WC_Cart $cart | Devuelva false para dejar el precio de un artículo en manos de WooCommerce (el complemento de cupones lo usa en 999). |
tiered_pricing_table/ | F | float|false $price, array $cartItem, string $cartItemKey, int $totalQuantity | Precio unitario fijado en el artículo del carrito. |
tiered_pricing_table/ | F | int $count, array $cartItem | Cantidad usada para elegir el nivel de un artículo (suma de las variaciones cuando Resumir variaciones está activado; las reglas globales cross suman los artículos coincidentes). |
tiered_pricing_table/ | F | bool $recalculate, array $cartItem | Igual que el anterior, para el precio mostrado del artículo. |
tiered_pricing_table/ | F | float $savings, WC_Cart $cart | Importe mostrado en la fila «Ahorro total» de los totales del carrito y del pago clásico. |
tiered_pricing_table/ | F | float|false $price, array $cartItem | Precio unitario mostrado. |
tiered_pricing_table/ | F | float $oldPrice, array $cartItem | Precio tachado que se muestra junto al precio con descuento. |
tiered_pricing_table/ | F | bool $consider, array $cartItem | Mostrar el precio de oferta como descuento en el precio del artículo del carrito. |
tiered_pricing_table/ | F | bool $recalculate, array $cartItem, string $key, string $subtotalHtml | Si la celda del subtotal se reescribe como antiguo/nuevo. |
tiered_pricing_table/ | F | bool $consider, array $cartItem, string $key | Igual para el subtotal (por defecto: la opción). |
tiered_pricing_table/ | F | bool $control, WC_Product $product | Dejar que el complemento de cantidad mínima establezca min en el campo de cantidad del carrito. |
tiered_pricing_table/ | F | int $quantity, int $productId | Cantidad comparada con el mínimo. |
tiered_pricing_table/ | F | bool $modify, WC_Order_Item_Product $item | Omitir un artículo al recalcular un pedido manual con precios escalonados. |
Página de producto, precio dinámico y catálogo
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | bool $render, int $parentProductId, ?int $variationId, array $settings | Devuelva false para suprimir todo el widget. |
tiered_pricing_table/ | F | array $settings, int $productId | Ajustes finales de renderizado (el id del producto es la variación cuando se ha resuelto). |
tiered_pricing_table/ | F | bool $enqueue | Si el script y la hoja de estilos del frontend se cargan en la página actual (por defecto true, en todas las páginas). Devuelva false según sus propias condiciones para omitirlos; una página que muestra una tabla de precios o una cuadrícula de productos los carga igualmente. |
tiered_pricing_table/ | F | int $threshold | Las variaciones por encima de este número se cargan mediante AJAX en lugar de renderizarse previamente (por defecto 10). |
tiered_pricing_table/ | A | WC_Product $parentProduct, ?int $variationId, array $settings | Antes del contenedor. |
tiered_pricing_table/ | A | PricingRule $rule, WC_Product $product, array $settings | Antes de incluir una plantilla de diseño (también para cada variación renderizada previamente o por AJAX). El modo de depuración imprime aquí. |
tiered_pricing_table/ | F | ?WC_Product_Variation $variation, int $productId | Variación mostrada por defecto en un producto variable. |
tiered_pricing_table/ | F | bool $wrap, WC_Product $product, string $priceHtml | Envolver el HTML del precio en el span de precio dinámico. |
tiered_pricing_table/ | F | bool $wrap, WC_Product $product | Igual para los productos variables. |
tiered_pricing_table/ | F | string $type ('dynamic'), WC_Product $product, string $priceHtml, string $context | dynamic (el JS reescribe el precio), static (lo deja como está), no-rules. $context es product-page o shop-loop. |
tiered_pricing_table/ | F | bool $modify, string $suffix, WC_Product $product, $price, $qty | Envolver {price_including_tax} / {price_excluding_tax} en spans que el JS pueda actualizar. |
tiered_pricing_table/ | F | array $settings, int $variationId, string $displayContext | Ajustes de las tablas de variaciones cargadas por AJAX. |
tiered_pricing_table/ | F | bool $verify, string $nonce, string $action | Activar la verificación de nonce en el endpoint AJAX get_pricing_table (por defecto false). |
tiered_pricing_table/ | F | string $newHtml, string $defaultHtml, WC_Product $product | HTML del precio en el catálogo (el más bajo / rango / personalizado). |
tiered_pricing_table/ | F | bool $format, string $defaultHtml, WC_Product $variation | Dar formato también a los precios de variación en el catálogo (por defecto false). |
tiered_pricing_table/ | F | array $variables | Marcadores ofrecidos en los ajustes de plantillas de texto (tp_quantity, tp_discount, tp_rounded_discount, tp_price, tp_base_unit_name, tp_required_quantity, tp_next_price, tp_next_discount, tp_actual_discount, tp_ys_price, tp_ys_total_price, tp_ys_percentage_discount). |
Hooks de plantilla
Se lanzan dentro de las plantillas de diseño de views/frontend/. $args en las acciones de etiqueta es ['id' => $id, 'style' => '<style>']; $qty es null para la fila base (mínimo) en row_columns.
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | A | PricingRule $rule | Antes de la tabla (estilos de tabla, tabla horizontal). |
tiered_pricing_table/ | A | PricingRule $rule | Imprima celdas de encabezado <th> adicionales (estilos de tabla, tabla horizontal). |
tiered_pricing_table/ | A | PricingRule $rule, ?int $qty | Imprima celdas <td> adicionales por fila. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings, string $templateName | Filas adicionales al final de <tbody>. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings, string $templateName | Pie de la tabla. |
tiered_pricing_table/ | A | PricingRule $rule, int $productId | Después de la tabla (la tabla horizontal pasa solo $rule). |
tiered_pricing_table/ | F | string $postfix ('+'), int $qty, PricingRule $rule, string $layout ('table'|'blocks') | Sufijo de la cantidad del último nivel (p. ej. 100+). |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia junto a una cantidad en los diseños de tabla. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia en la tabla horizontal. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia en los diseños de bloques. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia en los diseños de opciones. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia en el menú desplegable. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Insignia en las líneas de texto sin formato. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Columnas adicionales en la cuadrícula horizontal. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Bloques adicionales dentro de .tiered-pricing-blocks. |
tiered_pricing_table/ | A | PricingRule $rule | Después del contenedor de bloques. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Opciones adicionales. |
tiered_pricing_table/ | A | PricingRule $rule | Después de las opciones. |
tiered_pricing_table/ | A | PricingRule $rule | Opciones <li> adicionales. |
tiered_pricing_table/ | A | PricingRule $rule | Después de la lista desplegable. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Líneas adicionales. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Después de la lista. |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Alrededor del resumen de totales (tabla y detallado). |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Antes del resumen en línea. |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Después del resumen en línea. |
Etiquetas de nivel y columnas personalizadas
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | string $html, TierLabel $label | Marcado de la etiqueta renderizada. |
tiered_pricing_table/ | F | array<string,string> $types | Registrar un tipo de columna (tipo ⇒ etiqueta). |
tiered_pricing_table/ | F | array $types | price, number, text. |
tiered_pricing_table/ | F | array<string,string> $handlers | Tipo de columna ⇒ clase manejadora (amplía AbstractCustomColumn). |
tiered_pricing_table/ | F | bool $visible, AbstractCustomColumn $column | Ocultar/mostrar una columna. |
tiered_pricing_table/ | F | string $name, AbstractCustomColumn $column | Texto del encabezado de la columna. |
tiered_pricing_table/ | F | mixed $value, PricingRule $rule, ?int $qty, AbstractCustomColumn $column | Valor de la celda. |
Reglas de precios globales
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | ?GlobalPricingRule $rule, WC_Product $product, WP_User $user | La regla elegida para un producto/usuario: implemente aquí un arbitraje personalizado. |
tiered_pricing_table/ | F | bool $matched, GlobalPricingRule $rule, WP_User $user, WC_Product $product | Resultado de la lógica de coincidencia de una regla. |
tiered_pricing_table/ | F | GlobalPricingRule $rule | Regla construida a partir de los metadatos de la entrada: lea sus propios metadatos en $rule->data. |
tiered_pricing_table/ | F | bool $valid, GlobalPricingRule $rule | Si una regla se considera válida (tiene precios). |
tiered_pricing_table/ | F | array $lines, WC_Cart $cart | Las líneas del carrito que cuenta una regla de carrito (key, product, quantity, amount tras los precios escalonados, con o sin impuestos según el ajuste). |
tiered_pricing_table/ | F | ?GlobalPricingRule $rule, array $lines, WP_User $user | La regla de carrito a la que está sujeto el carrito (la de mayor prioridad, que coincida con el cliente y con una línea contada). |
tiered_pricing_table/ | F | OrderDiscount $discount, WC_Cart $cart, WP_User $user | El descuento que ha ganado el carrito, antes de aplicarse. |
tiered_pricing_table/ | F | string $code, GlobalPricingRule $rule | El código del cupón virtual (el título de la regla como slug, u order-discount-{id} cuando lo posee un cupón real). |
tiered_pricing_table/ | F | array $props, GlobalPricingRule $rule | Los datos del cupón entregados a WooCommerce (discount_type, amount, product_ids, …). |
tiered_pricing_table/ | F | string $label, OrderDiscount $discount | La etiqueta de la línea de descuento, con los marcadores rellenados. |
tiered_pricing_table/ | F | string $message, array $next, WC_Cart $cart | El mensaje «añada X más» ($next: regla, nivel, base, subtotal, cantidad, restante). |
tiered_pricing_table/ | F | array $missed, array $lines, WP_User $user | Los mínimos no alcanzados de las reglas de pedido coincidentes (rule, type, minimum, actual). |
tiered_pricing_table/ | F | ?array $progress, ?WC_Cart $cart, WP_User $user | El estado de la barra de envío gratuito antes de renderizarse (rule, mode, items, threshold, value, remaining, reached, percent); devuelva null para ocultar la barra. |
tiered_pricing_table/ | F | bool $has | Si la tienda tiene una regla de carrito en cualquier estado salvo la papelera: solo entonces la lista de reglas muestra su filtro de tipo, el botón de ajustes de Reglas de carrito y, si además hay reglas de producto, el tipo de cada fila (8.3.0+) |
tiered_pricing_table/ | F | bool $has | Si la tienda tiene una regla de precios de producto (las reglas guardadas antes de que existieran los tipos de regla cuentan como reglas de producto) (8.3.0+) |
tiered_pricing_table/ | F | bool $show | Si el consejo sobre el tipo de regla se abre en una regla nueva: por defecto mientras la tienda no tenga ninguna regla de precios y el usuario no lo haya descartado (8.3.0+) |
tiered_pricing_table/ | F | PricingRule $rule, GlobalPricingRule $globalRule, int $productId, string $priority | Antes de aplicar una regla coincidente ($priority: flexible | prefer-product | override). |
tiered_pricing_table/ | F | PricingRule $rule, GlobalPricingRule $globalRule, int $productId, string $priority | Después de aplicarla. |
tiered_pricing_table/ | F | FormTab[] $tabs, Form $form | Pestañas del editor de reglas. |
tiered_pricing_table/ | A | FormTab $tab, GlobalPricingRule $rule | Final de cada pestaña. |
tiered_pricing_table/ | A | int $ruleId, GlobalPricingRule $rule | Pestaña Cantidad, después del campo de mínimo. |
tiered_pricing_table/ | A | GlobalPricingRule $rule, int $ruleId | Al guardar, antes de $rule->save(): persista los campos personalizados. |
tiered_pricing_table/ | F | array $columns | Columnas de la tabla de la lista (objetos con getName()/render()). |
tiered_pricing_table/ | A | string $column, GlobalPricingRule $rule | Después de renderizar una celda de la tabla de la lista. |
Precios por rol
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | array $roles | Roles a los que puede dirigirse una regla de producto, como key => label: todos los roles de WordPress más guest (visitantes que no han iniciado sesión). |
tiered_pricing_table/ | F | string[] $metaSuffixes, string $role | Sufijos de metadatos cuya existencia significa «el rol tiene reglas» (por defecto _tiered_price_rules_type, _tiered_price_pricing_type). |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Reglas de niveles del rol leídas de los metadatos. |
tiered_pricing_table/ | F | string $type, string $role, int $productId | fixed | percentage | amount. |
tiered_pricing_table/ | F | ?int $minimum, string $role, int $productId | Cantidad mínima del rol. |
tiered_pricing_table/ | F | ?float $price, string $role, int $productId | Precio normal del rol. |
tiered_pricing_table/ | F | ?float $price, string $role, int $productId | Precio de oferta del rol. |
tiered_pricing_table/ | F | ?float $discount, string $role, int $productId | Descuento porcentual del rol. |
tiered_pricing_table/ | F | string $type, string $role, int $productId | sale_price | regular_price. |
tiered_pricing_table/ | F | string $type, string $role, int $productId | flat | percentage. |
tiered_pricing_table/ | F | string $status, string $role, int $productId | Estado de impuestos del rol (anulación). |
tiered_pricing_table/ | F | string $class, string $role, int $productId | Clase de impuestos del rol (anulación). |
tiered_pricing_table/ | A | int $productId, string $role | Después de eliminar las reglas de un rol de un producto. |
tiered_pricing_table/ | A | int $productId, array $postData, string $role, ?int $loop | Después de guardar las reglas de un rol desde el editor de productos. |
tiered_pricing_table/ | A | PricingRule $rule, RoleBasedPricingRule $roleRule, int $productId | Después de aplicar la regla del rol al PricingRule del producto. |
tiered_pricing_table/ | F | RoleBasedPricingRule $rule | Regla construida a partir de los metadatos. |
tiered_pricing_table/ | F | RoleBasedPricingRule $rule, string $role, array $data | Regla construida a partir de un array (importación). |
tiered_pricing_table/ | F | string[] $roles | Roles excluidos de la importación/exportación CSV (por defecto editor, author, contributor, shop_manager). |
Precios por cliente
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $metaSuffixes, int $userId | Igual que el equivalente del rol. |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Reglas de niveles del cliente. |
tiered_pricing_table/ | F | string $type, int $userId, int $productId | fixed | percentage | amount. |
tiered_pricing_table/ | F | ?int $minimum, int $userId, int $productId | Mínimo del cliente. |
tiered_pricing_table/ | F | ?float $price, int $userId, int $productId | Precio normal del cliente. |
tiered_pricing_table/ | F | ?float $price, int $userId, int $productId | Precio de oferta del cliente. |
tiered_pricing_table/ | F | ?float $discount, int $userId, int $productId | Descuento del cliente. |
tiered_pricing_table/ | F | string $type, int $userId, int $productId | sale_price | regular_price. |
tiered_pricing_table/ | F | string $type, int $userId, int $productId | flat | percentage. |
tiered_pricing_table/ | F | string $status, int $userId, int $productId | Estado de impuestos (anulación). |
tiered_pricing_table/ | F | string $class, int $userId, int $productId | Clase de impuestos (anulación). |
tiered_pricing_table/ | A | int $productId, int $userId | Después de eliminar las reglas de un cliente. |
tiered_pricing_table/ | A | int $productId, array $postData, int $userId, ?int $loop | Después de guardar las reglas de un cliente. |
tiered_pricing_table/ | A | PricingRule $rule, UserBasedPricingRule $userRule, int $productId | Después de aplicar la regla del cliente. |
tiered_pricing_table/ | F | UserBasedPricingRule $rule | Regla construida a partir de los metadatos. |
tiered_pricing_table/ | F | UserBasedPricingRule $rule, int $userId, array $data | Regla construida a partir de un array. |
Editor de productos del administrador
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | A | int $postId | Parte superior de la pestaña Precios escalonados. |
tiered_pricing_table/ | A | int $productId, ?int $loop, string $customPrefix | Después del campo de cantidad mínima: en la pestaña General de un producto simple (prefijo ''), en la sección Producto variable de un producto variable (prefijo '_variable', que también llevan los nombres de los campos) y en cada variación ($loop definido). |
tiered_pricing_table/ | A | int $postId | Antes de la sección Visualización. |
tiered_pricing_table/ | A | int $postId | Final de la sección Visualización (diseño y etiqueta de unidad); el lugar para campos personalizados por producto. |
tiered_pricing_table/ | A | int $postId | Dentro de la sección Producto variable (la primera sección de la pestaña, solo en productos variables), después de los niveles y los límites de cantidad del producto principal; aquí se muestran los campos de variación predeterminada, precios compartidos y cálculo del mínimo. |
tiered_pricing_table/ | A | int $postId | Dentro de la sección Visibilidad; la sección solo se muestra cuando algo se engancha aquí (Quién puede ver este producto, del complemento de tienda privada). |
tiered_pricing_table/ | A | int $postId | Parte inferior de la pestaña. |
tiered_pricing_table/ | F | bool $active | Mostrar la sección Precios de roles y clientes de la pestaña Precios escalonados (antes de 8.2.0 / 10.2.0 era una pestaña propia). |
tiered_pricing_table/ | A | int $postId | Parte superior de la sección Precios de roles y clientes. |
tiered_pricing_table/ | A | int $postId | Contenido de la sección (bloque de roles 99, bloque de clientes 100). |
tiered_pricing_table/ | A | int $postId | Parte inferior de la sección. |
tiered_pricing_table/ | F | bool $open, int $productId | Si la sección Precios de roles y clientes empieza abierta (por defecto: abierta en productos simples; en productos variables solo cuando el producto tiene precios por rol o por cliente). |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Inicio del componente del formulario de reglas. |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Después del selector fijo/porcentaje/importe. |
tiered_pricing_table/ | A | $entityId, $amount, ?string $role, ?int $loop, string $customPrefix, string $type | Dentro de cada fila de nivel. |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Final del componente. |
tiered_pricing_table/ | F | int $percent | Ancho de los campos de cantidad/precio (por defecto 50). |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix, array $data, array $request | Después de analizar el formulario de reglas desde $_POST. |
tiered_pricing_table/ | A | int $productId, string $role, ?int $loop | Dentro del formulario de precios de un rol. |
tiered_pricing_table/ | A | int $productId, string $role, ?int $loop | Dentro del formulario de precios de un rol (aquí se muestran los selectores de impuestos). |
tiered_pricing_table/ | A | int $productId, int $userId, ?int $loop | Dentro del formulario de precios de un cliente. |
tiered_pricing_table/ | A | int $productId, int $userId, ?int $loop | Dentro del formulario de precios de un cliente. |
tiered_pricing_table/ | F | ?Tip $tip, string $slug | Resolver un consejo de administración personalizado. |
API REST, importación y exportación
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $fieldClasses | Clases (que amplían ProductField) registradas como campos de producto REST de WooCommerce. |
tiered_pricing_table/ | F | string[] $objectTypes, ProductField $field | Tipos de objeto REST a los que se añade el campo (por defecto product, product_variation). |
tiered_pricing_table/ | F | array $columns | Columnas ofrecidas en la pantalla de asignación del importador CSV de WooCommerce. |
tiered_pricing_table/ | F | array $headerToKey | Asignación automática de los encabezados CSV a las columnas. |
tiered_pricing_table/ | A | int $quoteRequestId | Se guardó una solicitud de cotización (los correos electrónicos se enganchan aquí). |
Integraciones
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $classes | Clases de integración de plugins (de arranque; vea la nota anterior). |
tiered_pricing_table/ | F | array<string,string> $needleToClass | Integraciones de temas indexadas por una cadena en minúsculas que se compara con el nombre/plantilla del tema (de arranque). |
tiered_pricing_table/ | F | bool $supported, WC_Product $product | Si se ejecuta la mejora del esquema SEO en los productos variables; {slug} es yoast_seo, rank_math o seopress. |
Mayorista y tienda privada
Disponible desde la versión 8.0.0; el registro mayorista y la tienda privada forman parte del plugin gratuito, mientras que los métodos de pago y envío por rol requieren la versión premium. El pedido mínimo por rol pasó a ser una regla de carrito en 8.3.0 (vea los hooks order_discount/* en Reglas de precios globales). Los correos electrónicos son clases estándar WC_Email (TPT_Wholesale_Admin_New_Application, TPT_Wholesale_Customer_Received, TPT_Wholesale_Customer_Approved, TPT_Wholesale_Customer_Rejected), registradas mediante woocommerce_email_classes y activadas mediante woocommerce_email_actions, por lo que todos los filtros de correo electrónico de WooCommerce se les aplican.
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application | Se envió una solicitud mayorista; en este punto la cuenta del cliente ya existe. |
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application, int $decidedBy | La solicitud fue aprobada y el cliente tiene el rol mayorista. $decidedBy es el id del usuario que decidió, 0 en la aprobación automática. |
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application, int $decidedBy | La solicitud fue rechazada; el motivo se guarda con la solicitud. |
tiered_pricing_table/ | F | bool $open | Devuelva true para mantener abierta la solicitud actual a los visitantes mientras la tienda está cerrada (se ejecuta en template_redirect después de las excepciones integradas). |
Ajustes
| Hook | Tipo | Parámetros | Descripción |
|---|---|---|---|
tiered_pricing_table/ | F | SectionAbstract[] $sections | Pestañas de ajustes. |
tiered_pricing_table/ | F | array $fields | Campos de la pestaña General (después de combinar las subsecciones). |
tiered_pricing_table/ | F | string[] $subsectionClasses | Subsecciones de la pestaña General. |
tiered_pricing_table/ | F | array $fields | Campos del grupo Cálculo de precios de la pestaña General. |
tiered_pricing_table/ | F | array $fields | Interruptores de módulos de la pestaña Avanzado (llamada Herramientas antes de 8.0.0). |
tiered_pricing_table/ | F | array $fields | Campos mostrados después de los módulos en la pestaña Avanzado (antes de Caché y Depuración). |
tiered_pricing_table/ | F | string[] $subsectionClasses | Clases de subsección añadidas a la pestaña Mayorista (8.0.0+). |
tiered_pricing_table/ | F | array<string,int> $order | Orden de las pestañas de ajustes (section id => priority). |
tiered_pricing_table/ | F | bool $premium | Si el configurador de diseño trata el sitio como premium (desbloquea los controles solo premium). |
tiered_pricing_table/ | F | ?string $color | El color del tema detectado en una instalación nueva para el nivel activo (el fondo del botón de un tema de bloques, o el color de acento de Storefront, Astra, OceanWP y Flatsome). Devuelva un color hexadecimal para usar el suyo, null para el valor neutro por defecto; se descartan los colores sobre los que no se puede leer texto blanco. |
tiered_pricing_table/ | F | array<string,string[]> $styles | Estilos de diseño ocultos en la cuadrícula de productos (layout => styles; por defecto ['blocks' => ['style-8']]). |
tiered_pricing_table/ | F | array $rows | Filas de interruptores de integración. |
tiered_pricing_table/ | F | array<string,array> $categories | Grupos de integración (id => ['title','description']). |
tiered_pricing_table/ | A | — | Después de los campos de títulos de columna. |
tiered_pricing_table/ | A | — | Final del campo de títulos de columna (aquí se monta la interfaz de columnas personalizadas). |
Recursos
- Guía del usuario: documentación para propietarios de tiendas sobre cada función.
- Guías: artículos prácticos.
- Contáctenos: ¿falta un hook o tiene una pregunta de integración? Háganoslo saber.