Introduction
Cette page s’adresse aux développeurs qui veulent ajuster ou étendre Tiered Pricing Table for WooCommerce avec du code : lire et modifier les prix, remplacer des modèles, se brancher sur le JavaScript, utiliser l’API REST et, surtout, consulter la liste complète des actions et des filtres. La documentation destinée aux propriétaires de boutique se trouve dans le Guide de l’utilisateur.
Conventions
Le code se trouve dans l’espace de noms TierPricingTable\ (src/), les modèles dans views/. Chaque hook est préfixé par tiered_pricing_table/ et utilise / comme séparateur, par exemple tiered_pricing_table/price/pricing_rule. Les réglages sont des options préfixées par tier_pricing_table_. La plupart des filtres peuvent être branchés depuis un thème ou un plugin à tout moment ; les trois filtres de démarrage addons/list, integrations/plugins et integrations/themes s’exécutent pendant l’inclusion du fichier du plugin et doivent être branchés depuis un plugin must-use ou un plugin chargé avant tier-pricing-table.
Prix et règles
Lire la règle et le prix effectifs
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
Modifier la règle de n’importe quel produit
tiered_pricing_table/price/pricing_rule reçoit le PricingRule après la lecture des métadonnées du produit. Les fournisseurs intégrés utilisent ces priorités ; choisissez la vôtre par rapport à elles : limites de quantité 1, règles de catégorie 10, par rôle 20, par client 25, règles globales 30, demande de devis 99, conversion de devise 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 );
Autres filtres utiles : …/price/price_by_rules (prix unitaire final pour une quantité), …/price/round_price / …/price/round_precision, …/cart/product_cart_price (prix appliqué à une ligne du panier), …/cart/total_product_count (quantité utilisée pour choisir le palier dans le panier), …/cart/need_price_recalculation (ignorer une ligne), …/services/regular_pricing/price (prix normal/promotionnel ajusté pour l’utilisateur courant), …/global_pricing/matched_pricing_rule (quelle règle globale s’applique).
Écrire des règles par programmation
| Clé de métadonnée (produit / variation) | Valeur |
|---|---|
_fixed_price_rules | array<int qty, string price> : par exemple [5 => '9.50', 10 => '8.00'] |
_percentage_price_rules | array<int qty, string percent> |
_amount_price_rules | array<int qty, string amount> : un montant déduit du prix du produit par unité |
_tiered_price_rules_type | fixed | percentage | amount |
_tiered_price_minimum_qty | entier > 1 |
_tiered_pricing_maximum_quantity, _tiered_pricing_group_of_quantity | entier (maximum, pas) |
_tiered_price_mix_and_match_minimum | yes | no (parent variable) |
_tiered_pricing_template, _tiered_pricing_base_unit_name | identifiant de mise en page ; ['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 | règles par rôle ({role} = identifiant du rôle) ; les règles par client utilisent _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();
Métadonnées de règle globale d’une règle de panier (_tpt_rule_kind = order) : _tpt_rule_kind (product \| order), _tpt_order_basis (amount \| quantity : ce à quoi les paliers sont comparés), _tpt_order_tiers (lignes de from et 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() accepte les mêmes clés sans le préfixe _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). Lors d’une mise à jour, OrderDiscounts\MinimumsMigration transforme le tableau des minimums des anciennes règles de panier par rôle en une règle de commande par rôle (l’option tier_pricing_table_order_minimums_migrated en garde la trace). Dans le panier, OrderDiscounts\OrderDiscountResolver::resolve( WC_Cart $cart, ?WP_User $user ) renvoie le OrderDiscount que le panier a gagné (règle, palier, sous-total pris en compte, propriétés du coupon) et nextTier() ce qui manque pour le suivant. OrderDiscounts\FreeShippingBar::progress( ?WC_Cart $cart, ?WP_User $user ) renvoie l’état de la barre de livraison gratuite (règle, mode, seuil, valeur, reste, atteint, pourcentage), progressFor( $rule, $counted ) la même chose à partir d’une règle et de lignes comptées, et render( $context ) le HTML de la barre.
Modèles
Afficher le tableau vous-même
ob_start();
\TierPricingTable\PricingTable::getInstance()->renderPricingTable( $product_id, null, [ 'display' => true, 'display_type' => 'blocks', 'title' => 'Volume pricing' ] );
$html = ob_get_clean();
Clés de réglages que vous pouvez passer : 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. Les mêmes clés fonctionnent comme attributs de shortcode. Utilisez tiered_pricing_table/should_render_pricing_table pour supprimer l’affichage automatique et tiered_pricing_table/display_settings pour modifier les réglages à la volée.
Remplacer les modèles depuis un thème
Copiez n’importe quel fichier du dossier views/frontend/ du plugin (tiered-pricing-table.php, tiered-pricing-blocks-style-3.php, summary-table.php, …) dans **wp-content/themes/{your-theme}/tiered-pricing-table/** et modifiez-le là. tiered_pricing_table/template/location permet à un plugin de rediriger un modèle.

Variables dans les modèles de mise en page : $pricing_rule (PricingRule), $price_rules, $pricing_type, $minimum, $product, $product_id, $settings, $id.
Respecter le contrat de balisage
Le JavaScript lit le balisage : conservez l’id de l’élément racine, data-product-id, data-price-rules, data-minimum, data-regular-price, data-sale-price, data-price, data-product-price-suffix, un élément par palier avec data-tiered-quantity / data-tiered-price / data-tiered-price-exclude-taxes / data-tiered-price-include-taxes, la ligne de base avec data-tiered-quantity="{minimum}" et la classe tiered-pricing--active, ainsi que les fonctions utilitaires tptParseOptionText() / tptParsePlainText().
Injecter du contenu dans les mises en page
// 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' );
Tous les hooks de mise en page sont listés sous Hooks de modèle.
JavaScript
Le moteur frontend (tiered-pricing-table-front-js, jQuery) expose 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 ); }
} );
Le prix du produit affiché en direct est le HTML de prix de WooCommerce enveloppé dans <span class="tiered-pricing-dynamic-price-wrapper" data-price-type="dynamic|static|no-rules"> ; renvoyez static depuis tiered_pricing_table/frontend/default_price_behaviour_type pour conserver le prix de WooCommerce, ou false depuis …/frontend/wrap_price pour ignorer l’enveloppe. Points d’accroche de style : .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, bloc et widget
| Point d’intégration | Détails |
|---|---|
[tiered-pricing-table] | product_id (l’article courant par défaut) ainsi que n’importe quelle clé de réglages de Afficher le tableau vous-même : par exemple [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] | Le formulaire de demande de compte grossiste (8.0.0+). Aucun attribut ; le formulaire, ses champs et ses messages viennent de Réglages → Vente en gros. Affiche une note réservée au gérant de boutique tant que la fonctionnalité est désactivée. |
[tiered_pricing_free_shipping_bar] | La barre de livraison gratuite de la règle de panier dont relève le panier du visiteur (8.3.0+, premium). Aucun attribut ; les messages, les couleurs et la hauteur viennent de la règle et de la page de réglages des règles de panier (la section de réglages order-rules, listée dans la navigation uniquement lorsqu’elle est ouverte). Affiche un div.tpt-free-shipping-bar-live vide lorsqu’aucune règle avec barre ne s’applique ; les fragments du panier actualisent chaque conteneur de ce type lors d’un ajout au panier. |
Block tiered-pricing-table/free-shipping-bar | La même barre sous forme de bloc (aucun attribut ; prend en charge l’alignement et l’espacement). |
Block tiered-pricing-table/tiered-pricing-block | displayType, title, activeTierColor, showDiscountColumn, titres de colonnes |
Elementor widget tiered-pricing-table | product_id, display_type, title, active_tier_color, titres de colonnes, réglages des options et de l’unité de mesure |
API REST
Les points d’accès produit et variation de WooCommerce (/wp-json/wc/v3/products/{id}, /products/{id}/variations/{vid}) lisent et écrivent ces champs :
| Champ | Valeur |
|---|---|
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 | entier ou 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 } } : l’écriture remplace toutes les données de rôle ; envoyez les paliers et le minimum sous la forme 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 } }
}
Ajoutez votre propre champ en étendant TierPricingTable\Services\API\ProductFields\ProductField et en ajoutant la classe avec tiered_pricing_table/api/product_fields. Routes du plugin : tier-pricing-table/v1/quote-request (POST, public), /quote-forms, /quote-settings, /tax-settings, tier-pricing-table/features/tier-labels/v1/labels, …/custom-columns/v1/columns, …/tools/v1/*. Colonnes d’import/export CSV WooCommerce : tiered_price_fixed, tiered_price_percentage (qty:value,…), tiered_price_type, tiered_price_minimum et, par rôle, {role}_tiered_price_*.
Étendre l’administration
// 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 ] ) );
- Onglets et champs de réglages :
tiered_pricing_table/settings/sections,…/general_settings,…/general_subsections,…/calculation_logic(groupe Calcul des prix),…/advanced_settings,…/tools_settings,…/sections_order. Types de champs :tpt_switch_option,tpt_display_type,tpt_text_template,tpt_link_button. - Éditeur de produit : affichez des champs sur
tiered_pricing_table/admin/pricing_tab_begin|after_minimum_order_quantity_field|advance_product_options|pricing_tab_end($postId;after_minimum_order_quantity_fieldtransmet aussi$loopet le préfixe du nom de champ,'_variable'dans la section Produit variable) et à l’intérieur du formulaire de règles (…/admin/tiered_pricing_rules_form/form_begin|inputs|form_end) ; enregistrez surwoocommerce_process_product_meta/woocommerce_save_product_variation. Nommez les champs avecTierPricingTable\Forms\Form::getFieldName( $base, $role, $loop ). - Règles par rôle / par client : affichez sur
…/admin/role_based_rules/after_tiered_pricing_rules_field(etuser_based_rules), enregistrez sur…/role_based_rules/save_role_based_rules(etuser_based_rules/save_user_based_rules). - Règles globales : ajoutez un onglet avec
tiered_pricing_table/global_pricing/form_tabs(étendezCPT\Form\FormTab), enregistrez dans…/global_pricing/before_updating, lisez vos métadonnées dans…/global_pricing/after_built_rule, ajoutez des colonnes de liste avec…/global_pricing/columns. - Colonnes de tableau personnalisées : étendez
Addons\CustomColumns\Columns\AbstractCustomColumnet enregistrez-la avectiered_pricing_table/custom_columns/available_columns_types+…/custom_columns/columns_handlers. - Modules complémentaires : étendez
Addons\AbstractAddonet ajoutez-le avectiered_pricing_table/addons/list(filtre de démarrage) ; il obtient un interrupteur dans l’onglet Modules.
Débogage
- Le mode débogage (Réglages → Modules → Débogage) affiche la règle résolue sous chaque ligne du panier et dans le tableau de prix, y compris le journal écrit avec
PricingRule::logPricingModification(). - Cache : le HTML des prix du catalogue est mis en cache dans le transient
tpt_product_data; videz-le depuis Réglages → Modules → Cache ou avecServiceContainer::getInstance()->getCache()->purge(). $GLOBALS['tpt_current_user_id']fait exécuter chaque calcul de prix pour cet utilisateur (les commandes manuelles l’utilisent).
Référence des hooks
Chaque filtre et chaque action déclenchés par le plugin, regroupés par thème. Le Type est F (filtre : renvoyez le premier paramètre) ou A (action). Les paramètres sont listés dans l’ordre ; le premier paramètre d’un filtre est la valeur à renvoyer. Chaque ligne est accessible par un lien direct (l’identifiant de la ligne est hook- + le nom du hook dont les caractères non alphanumériques sont remplacés par -). Tous les noms sont préfixés par tiered_pricing_table/ sauf indication contraire.
Démarrage et services
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tpt_fs_loaded | A | — | SDK Freemius initialisé (tpt_fs() disponible). |
tiered_pricing_table/ | F | string $className | Nom de classe instanciée par ServiceContainer::initService() : renvoyez une sous-classe pour remplacer un service. |
tiered_pricing_table/ | F | array<string,AbstractAddon> $addons | Instances des modules complémentaires indexées par classe, avant run() : ajoutez, retirez ou remplacez des modules. |
tiered_pricing_table/ | F | string[] $types | Par défaut simple, variation, subscription, subscription-variation. |
tiered_pricing_table/ | F | string[] $types | Par défaut variable, variable-subscription. |
tiered_pricing_table/ | F | string[] $types | Par défaut variation, subscription-variation. |
tiered_pricing_table/ | F | array<string,string> $layouts | Identifiant de mise en page ⇒ libellé (table, blocks, options, dropdown, horizontal-table, plain-text, tooltip). |
tiered_pricing_table/ | F | WP_User $user | L’utilisateur pour lequel les prix sont calculés (par défaut : l’utilisateur courant, ou $GLOBALS['tpt_current_user_id']). |
tiered_pricing_table/ | F | string[] $roles, int $userId | Rôles utilisés pour la tarification par rôle et les clés de cache ; un visiteur non connecté reçoit le pseudo-rôle guest. |
tiered_pricing_table/ | F | string $separator | Séparateur des listes qty:price dans l’import/export CSV (par défaut ,). |
tiered_pricing_table/ | F | string $separator | Séparateur entre la quantité et le prix dans une même règle à l’export CSV (par défaut :). Les tableurs lisent 20:100 comme une heure ; renvoyez = pour obtenir 20=100. L’importeur accepte :, = et la valeur configurée. |
tiered_pricing_table/ | F | string $absolutePath, string $template | Chemin final de n’importe quel modèle (frontend/…, admin/…, addons/…). |
tiered_pricing_table/ | A | string $absolutePath, array $variables | Avant l’inclusion d’un modèle. |
tiered_pricing_table/ | A | string $absolutePath, array $variables | Après l’inclusion d’un modèle. |
tiered_pricing_table/ | F | string $url, string $file | URL d’une ressource JS du plugin. |
tiered_pricing_table/ | F | string $url, string $file | URL d’une ressource CSS du plugin. |
Calcul des prix
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | PricingRule $rule, int $productId | Point d’extension principal. La règle effective d’un produit après lecture des métadonnées au niveau du produit ; les fournisseurs (catégorie 10, rôle 20, client 25, global 30, devis 99) la modifient ici. Mise en cache par requête. |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Règles au niveau du produit lues dans les métadonnées (contexte view uniquement). |
tiered_pricing_table/ | F | float|false $price, int $quantity, int $productId, string $context, string $place, PricingRule $rule | Prix unitaire final pour une quantité (false = aucun palier ne correspond). |
tiered_pricing_table/ | F | bool $round | Indique s’il faut arrondir les prix des paliers (par défaut : l’option Arrondir le prix). |
tiered_pricing_table/ | F | int $decimals | Précision d’arrondi (par défaut max(2, wc_get_price_decimals())). |
tiered_pricing_table/ | F | int $decimals, float $percent, ?WC_Product $product, ?PricingRule $rule | Décimales des remises en pourcentage affichées dans chaque mise en page et dans le champ {tp_discount} (par défaut 2 ; renvoyez 0 pour des nombres entiers comme « 10 % »). |
tiered_pricing_table/ | F | string $type, int $productId | Type de tarification au niveau du produit (fixed | percentage | amount). |
tiered_pricing_table/ | F | ?int $minimum, int $productId | Quantité minimale de commande au niveau du produit. |
tiered_pricing_table/ | F | bool $enabled | Renvoyez true pour activer RegularPricingService (filtres de prix WC). Les modules globaux, par rôle et par client le font. |
tiered_pricing_table/ | F | ?float $newPrice, ?WC_Product $product, ?string $specific ('regular'|'sale'|null), $originalPrice | Prix normal/promotionnel/courant ajusté pour l’utilisateur courant (null conserve la valeur de WooCommerce). |
tiered_pricing_table/ | F | bool $override | Indique si les produits à prix zéro voient leur prix remplacé (par défaut true). |
tiered_pricing_table/ | F | ?int $value, int $productId, string|false $role | Quantité maximale pour un produit ; les valeurs propres à un rôle sont appliquées ici. |
tiered_pricing_table/ | F | ?int $value, int $productId, string|false $role | Pas de quantité pour un produit. |
tiered_pricing_table/ | F | bool $skip, int $productId, WC_Product $product | Ignorer les anciennes règles au niveau de la catégorie pour un produit. |
tiered_pricing_table/ | F | bool $check, WC_Product $product | Renvoyez true pour que productHasPricingRules() analyse les variations au lieu de supposer qu’un produit variable a des règles. |
Panier et paiement
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | bool $recalculate, array $cartItem, WC_Cart $cart | Renvoyez false pour laisser le prix d’une ligne à WooCommerce (le module de coupons l’utilise à 999). |
tiered_pricing_table/ | F | float|false $price, array $cartItem, string $cartItemKey, int $totalQuantity | Prix unitaire appliqué à la ligne du panier. |
tiered_pricing_table/ | F | int $count, array $cartItem | Quantité utilisée pour choisir le palier d’une ligne (somme des variations lorsque Regrouper les variations est activé ; les règles globales cross additionnent les lignes correspondantes). |
tiered_pricing_table/ | F | bool $recalculate, array $cartItem | Idem, pour le prix de ligne affiché. |
tiered_pricing_table/ | F | float $savings, WC_Cart $cart | Montant affiché dans la ligne « Économies totales » des totaux du panier et du paiement classique. |
tiered_pricing_table/ | F | float|false $price, array $cartItem | Prix unitaire affiché. |
tiered_pricing_table/ | F | float $oldPrice, array $cartItem | Prix barré affiché à côté du prix remisé. |
tiered_pricing_table/ | F | bool $consider, array $cartItem | Afficher le prix promotionnel comme une remise dans le prix de la ligne du panier. |
tiered_pricing_table/ | F | bool $recalculate, array $cartItem, string $key, string $subtotalHtml | Indique si la cellule du sous-total est réécrite en ancien/nouveau prix. |
tiered_pricing_table/ | F | bool $consider, array $cartItem, string $key | Idem pour le sous-total (par défaut : l’option). |
tiered_pricing_table/ | F | bool $control, WC_Product $product | Laisser le module de quantité minimale définir min sur le champ de quantité du panier. |
tiered_pricing_table/ | F | int $quantity, int $productId | Quantité comparée au minimum. |
tiered_pricing_table/ | F | bool $modify, WC_Order_Item_Product $item | Ignorer une ligne lors du recalcul d’une commande manuelle avec la tarification échelonnée. |
Page produit, prix dynamique et catalogue
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | bool $render, int $parentProductId, ?int $variationId, array $settings | Renvoyez false pour supprimer tout le widget. |
tiered_pricing_table/ | F | array $settings, int $productId | Réglages de rendu finaux (l’identifiant du produit est celui de la variation lorsqu’elle est résolue). |
tiered_pricing_table/ | F | bool $enqueue | Indique si le script et la feuille de style du frontend se chargent sur la page courante (par défaut true, sur toutes les pages). Renvoyez false selon vos propres conditions pour les ignorer ; une page qui affiche un tableau de prix ou une grille de produits les charge quand même. |
tiered_pricing_table/ | F | int $threshold | Au-delà de ce nombre, les variations se chargent par AJAX au lieu d’être pré-rendues (10 par défaut). |
tiered_pricing_table/ | A | WC_Product $parentProduct, ?int $variationId, array $settings | Avant l’enveloppe. |
tiered_pricing_table/ | A | PricingRule $rule, WC_Product $product, array $settings | Avant l’inclusion d’un modèle de mise en page (aussi pour chaque variation pré-rendue ou chargée par AJAX). Le mode débogage affiche ses informations ici. |
tiered_pricing_table/ | F | ?WC_Product_Variation $variation, int $productId | Variation affichée par défaut pour un produit variable. |
tiered_pricing_table/ | F | bool $wrap, WC_Product $product, string $priceHtml | Envelopper le HTML du prix dans le span de prix dynamique. |
tiered_pricing_table/ | F | bool $wrap, WC_Product $product | Idem pour les produits variables. |
tiered_pricing_table/ | F | string $type ('dynamic'), WC_Product $product, string $priceHtml, string $context | dynamic (le JS réécrit le prix), static (le laisse tel quel), no-rules. $context vaut product-page ou shop-loop. |
tiered_pricing_table/ | F | bool $modify, string $suffix, WC_Product $product, $price, $qty | Envelopper {price_including_tax} / {price_excluding_tax} dans des spans que le JS peut mettre à jour. |
tiered_pricing_table/ | F | array $settings, int $variationId, string $displayContext | Réglages des tableaux de variations chargés par AJAX. |
tiered_pricing_table/ | F | bool $verify, string $nonce, string $action | Activer la vérification du nonce sur le point d’accès AJAX get_pricing_table (par défaut false). |
tiered_pricing_table/ | F | string $newHtml, string $defaultHtml, WC_Product $product | HTML du prix du catalogue (le plus bas / la fourchette / personnalisé). |
tiered_pricing_table/ | F | bool $format, string $defaultHtml, WC_Product $variation | Formater aussi les prix des variations dans le catalogue (par défaut false). |
tiered_pricing_table/ | F | array $variables | Champs proposés dans les réglages de modèles de texte (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 modèle
Déclenchés à l’intérieur des modèles de mise en page dans views/frontend/. $args pour les actions de libellé vaut ['id' => $id, 'style' => '<style>'] ; $qty vaut null pour la ligne de base (minimum) dans row_columns.
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | A | PricingRule $rule | Avant le tableau (styles de tableau, tableau horizontal). |
tiered_pricing_table/ | A | PricingRule $rule | Affichez des cellules d’en-tête <th> supplémentaires (styles de tableau, tableau horizontal). |
tiered_pricing_table/ | A | PricingRule $rule, ?int $qty | Affichez des cellules <td> supplémentaires pour chaque ligne. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings, string $templateName | Lignes supplémentaires à la fin de <tbody>. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings, string $templateName | Pied du tableau. |
tiered_pricing_table/ | A | PricingRule $rule, int $productId | Après le tableau (le tableau horizontal ne passe que $rule). |
tiered_pricing_table/ | F | string $postfix ('+'), int $qty, PricingRule $rule, string $layout ('table'|'blocks') | Suffixe de la quantité du dernier palier (par exemple 100+). |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge à côté d’une quantité dans les mises en page en tableau. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge dans le tableau horizontal. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge dans les mises en page en blocs. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge dans les mises en page en options. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge dans la liste déroulante. |
tiered_pricing_table/ | A | PricingRule $rule, int $qty, array $args | Badge dans les lignes de texte simple. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Colonnes supplémentaires dans la grille horizontale. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Blocs supplémentaires à l’intérieur de .tiered-pricing-blocks. |
tiered_pricing_table/ | A | PricingRule $rule | Après le conteneur de blocs. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Options supplémentaires. |
tiered_pricing_table/ | A | PricingRule $rule | Après les options. |
tiered_pricing_table/ | A | PricingRule $rule | Options <li> supplémentaires. |
tiered_pricing_table/ | A | PricingRule $rule | Après la liste déroulante. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Lignes supplémentaires. |
tiered_pricing_table/ | A | PricingRule $rule, array $settings | Après la liste. |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Autour du récapitulatif des totaux (tableau et détaillé). |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Avant le récapitulatif en ligne. |
tiered_pricing_table/ | A | string $totalLabel, string $eachLabel | Après le récapitulatif en ligne. |
Libellés de paliers et colonnes personnalisées
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | string $html, TierLabel $label | Balisage du libellé rendu. |
tiered_pricing_table/ | F | array<string,string> $types | Enregistrer un type de colonne (type ⇒ libellé). |
tiered_pricing_table/ | F | array $types | price, number, text. |
tiered_pricing_table/ | F | array<string,string> $handlers | Type de colonne ⇒ classe de gestionnaire (étend AbstractCustomColumn). |
tiered_pricing_table/ | F | bool $visible, AbstractCustomColumn $column | Masquer/afficher une colonne. |
tiered_pricing_table/ | F | string $name, AbstractCustomColumn $column | Texte d’en-tête de colonne. |
tiered_pricing_table/ | F | mixed $value, PricingRule $rule, ?int $qty, AbstractCustomColumn $column | Valeur de la cellule. |
Règles de tarification globales
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | ?GlobalPricingRule $rule, WC_Product $product, WP_User $user | La règle choisie pour un produit/utilisateur : implémentez ici un arbitrage personnalisé. |
tiered_pricing_table/ | F | bool $matched, GlobalPricingRule $rule, WP_User $user, WC_Product $product | Résultat de la logique de correspondance d’une règle. |
tiered_pricing_table/ | F | GlobalPricingRule $rule | Règle construite à partir des métadonnées de l’article : lisez vos propres métadonnées dans $rule->data. |
tiered_pricing_table/ | F | bool $valid, GlobalPricingRule $rule | Indique si une règle est considérée comme valide (elle a une tarification). |
tiered_pricing_table/ | F | array $lines, WC_Cart $cart | Les lignes du panier qu’une règle de panier compte (key, product, quantity, amount après les prix échelonnés, avec ou sans taxes selon le réglage). |
tiered_pricing_table/ | F | ?GlobalPricingRule $rule, array $lines, WP_User $user | La règle de panier dont relève le panier (la plus prioritaire, correspondant au client, avec une ligne comptée). |
tiered_pricing_table/ | F | OrderDiscount $discount, WC_Cart $cart, WP_User $user | La remise que le panier a gagnée, avant son application. |
tiered_pricing_table/ | F | string $code, GlobalPricingRule $rule | Le code du coupon virtuel (le titre de la règle sous forme d’identifiant, ou order-discount-{id} lorsqu’un vrai coupon en est propriétaire). |
tiered_pricing_table/ | F | array $props, GlobalPricingRule $rule | Les données du coupon transmises à WooCommerce (discount_type, amount, product_ids, …). |
tiered_pricing_table/ | F | string $label, OrderDiscount $discount | Le libellé de la ligne de remise, champs remplis. |
tiered_pricing_table/ | F | string $message, array $next, WC_Cart $cart | Le message « ajoutez X de plus » ($next : règle, palier, base, sous-total, quantité, reste). |
tiered_pricing_table/ | F | array $missed, array $lines, WP_User $user | Les minimums non atteints des règles de commande correspondantes (rule, type, minimum, actual). |
tiered_pricing_table/ | F | ?array $progress, ?WC_Cart $cart, WP_User $user | L’état de la barre de livraison gratuite avant son rendu (rule, mode, items, threshold, value, remaining, reached, percent) ; renvoyez null pour masquer la barre. |
tiered_pricing_table/ | F | bool $has | Indique si la boutique a une règle de panier, quel que soit son statut sauf la corbeille : ce n’est qu’alors que la liste des règles affiche son filtre de type, le bouton des réglages des règles de panier et, avec aussi des règles de produit, le type de chaque ligne (8.3.0+) |
tiered_pricing_table/ | F | bool $has | Indique si la boutique a une règle de tarification de produit (les règles enregistrées avant l’existence des types de règles comptent comme des règles de produit) (8.3.0+) |
tiered_pricing_table/ | F | bool $show | Indique si l’astuce sur le type de règle s’ouvre sur une nouvelle règle : par défaut tant que la boutique n’a aucune règle de tarification et que l’utilisateur ne l’a pas fermée (8.3.0+) |
tiered_pricing_table/ | F | PricingRule $rule, GlobalPricingRule $globalRule, int $productId, string $priority | Avant l’application d’une règle correspondante ($priority : flexible | prefer-product | override). |
tiered_pricing_table/ | F | PricingRule $rule, GlobalPricingRule $globalRule, int $productId, string $priority | Après son application. |
tiered_pricing_table/ | F | FormTab[] $tabs, Form $form | Onglets de l’éditeur de règles. |
tiered_pricing_table/ | A | FormTab $tab, GlobalPricingRule $rule | Fin de chaque onglet. |
tiered_pricing_table/ | A | int $ruleId, GlobalPricingRule $rule | Onglet Quantité, après le champ du minimum. |
tiered_pricing_table/ | A | GlobalPricingRule $rule, int $ruleId | À l’enregistrement, avant $rule->save() : conservez les champs personnalisés. |
tiered_pricing_table/ | F | array $columns | Colonnes du tableau de liste (objets avec getName()/render()). |
tiered_pricing_table/ | A | string $column, GlobalPricingRule $rule | Après l’affichage d’une cellule du tableau de liste. |
Tarification par rôle
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | array $roles | Rôles qu’une règle de produit peut cibler, sous la forme key => label : chaque rôle WordPress plus guest (visiteurs non connectés). |
tiered_pricing_table/ | F | string[] $metaSuffixes, string $role | Suffixes de métadonnées dont l’existence signifie « le rôle a des règles » (par défaut _tiered_price_rules_type, _tiered_price_pricing_type). |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Règles de paliers du rôle lues dans les métadonnées. |
tiered_pricing_table/ | F | string $type, string $role, int $productId | fixed | percentage | amount. |
tiered_pricing_table/ | F | ?int $minimum, string $role, int $productId | Quantité minimale du rôle. |
tiered_pricing_table/ | F | ?float $price, string $role, int $productId | Prix normal du rôle. |
tiered_pricing_table/ | F | ?float $price, string $role, int $productId | Prix promotionnel du rôle. |
tiered_pricing_table/ | F | ?float $discount, string $role, int $productId | Remise en pourcentage du rôle. |
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 | Remplacement du statut de taxe du rôle. |
tiered_pricing_table/ | F | string $class, string $role, int $productId | Remplacement de la classe de taxe du rôle. |
tiered_pricing_table/ | A | int $productId, string $role | Après la suppression des règles d’un rôle sur un produit. |
tiered_pricing_table/ | A | int $productId, array $postData, string $role, ?int $loop | Après l’enregistrement des règles d’un rôle depuis l’éditeur de produit. |
tiered_pricing_table/ | A | PricingRule $rule, RoleBasedPricingRule $roleRule, int $productId | Après l’application de la règle du rôle au PricingRule du produit. |
tiered_pricing_table/ | F | RoleBasedPricingRule $rule | Règle construite à partir des métadonnées. |
tiered_pricing_table/ | F | RoleBasedPricingRule $rule, string $role, array $data | Règle construite à partir d’un tableau (import). |
tiered_pricing_table/ | F | string[] $roles | Rôles exclus de l’import/export CSV (par défaut editor, author, contributor, shop_manager). |
Tarification par client
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $metaSuffixes, int $userId | Identique à l’équivalent pour les rôles. |
tiered_pricing_table/ | F | array $rules, int $productId, string $type | Règles de paliers du client. |
tiered_pricing_table/ | F | string $type, int $userId, int $productId | fixed | percentage | amount. |
tiered_pricing_table/ | F | ?int $minimum, int $userId, int $productId | Minimum du client. |
tiered_pricing_table/ | F | ?float $price, int $userId, int $productId | Prix normal du client. |
tiered_pricing_table/ | F | ?float $price, int $userId, int $productId | Prix promotionnel du client. |
tiered_pricing_table/ | F | ?float $discount, int $userId, int $productId | Remise du client. |
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 | Remplacement du statut de taxe. |
tiered_pricing_table/ | F | string $class, int $userId, int $productId | Remplacement de la classe de taxe. |
tiered_pricing_table/ | A | int $productId, int $userId | Après la suppression des règles d’un client. |
tiered_pricing_table/ | A | int $productId, array $postData, int $userId, ?int $loop | Après l’enregistrement des règles d’un client. |
tiered_pricing_table/ | A | PricingRule $rule, UserBasedPricingRule $userRule, int $productId | Après l’application de la règle du client. |
tiered_pricing_table/ | F | UserBasedPricingRule $rule | Règle construite à partir des métadonnées. |
tiered_pricing_table/ | F | UserBasedPricingRule $rule, int $userId, array $data | Règle construite à partir d’un tableau. |
Éditeur de produit dans l’administration
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | A | int $postId | Haut de l’onglet Tarification échelonnée. |
tiered_pricing_table/ | A | int $productId, ?int $loop, string $customPrefix | Après le champ de quantité minimale : dans l’onglet Général d’un produit simple (préfixe ''), dans la section Produit variable d’un produit variable (préfixe '_variable', que portent aussi les noms des champs) et dans chaque variation ($loop défini). |
tiered_pricing_table/ | A | int $postId | Avant la section Affichage. |
tiered_pricing_table/ | A | int $postId | Fin de la section Affichage (mise en page et libellé de l’unité) ; l’endroit idéal pour des champs personnalisés par produit. |
tiered_pricing_table/ | A | int $postId | À l’intérieur de la section Produit variable (la première section de l’onglet, produits variables uniquement), après les paliers et les limites de quantité du parent ; la variation par défaut, les prix partagés et les champs de calcul du minimum s’affichent ici. |
tiered_pricing_table/ | A | int $postId | À l’intérieur de la section Visibilité ; la section ne s’affiche que si quelque chose s’y accroche (le champ Qui peut voir ce produit du module de boutique privée). |
tiered_pricing_table/ | A | int $postId | Bas de l’onglet. |
tiered_pricing_table/ | F | bool $active | Afficher la section Prix par rôle et par client de l’onglet Tarification échelonnée (un onglet à part avant 8.2.0 / 10.2.0). |
tiered_pricing_table/ | A | int $postId | Haut de la section Prix par rôle et par client. |
tiered_pricing_table/ | A | int $postId | Contenu de la section (bloc des rôles 99, bloc des clients 100). |
tiered_pricing_table/ | A | int $postId | Bas de la section. |
tiered_pricing_table/ | F | bool $open, int $productId | Indique si la section Prix par rôle et par client démarre ouverte (par défaut : ouverte sur les produits simples, sur les produits variables seulement lorsque le produit a des prix par rôle ou par client). |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Début du composant du formulaire de règles. |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Après le sélecteur fixe/pourcentage/montant. |
tiered_pricing_table/ | A | $entityId, $amount, ?string $role, ?int $loop, string $customPrefix, string $type | À l’intérieur de chaque ligne de palier. |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix | Fin du composant. |
tiered_pricing_table/ | F | int $percent | Largeur des champs de quantité/prix (50 par défaut). |
tiered_pricing_table/ | A | $entityId, ?string $role, ?int $loop, string $customPrefix, array $data, array $request | Après l’analyse du formulaire de règles depuis $_POST. |
tiered_pricing_table/ | A | int $productId, string $role, ?int $loop | À l’intérieur du formulaire de tarification d’un rôle. |
tiered_pricing_table/ | A | int $productId, string $role, ?int $loop | À l’intérieur du formulaire de tarification d’un rôle (les sélecteurs de taxe s’affichent ici). |
tiered_pricing_table/ | A | int $productId, int $userId, ?int $loop | À l’intérieur du formulaire de tarification d’un client. |
tiered_pricing_table/ | A | int $productId, int $userId, ?int $loop | À l’intérieur du formulaire de tarification d’un client. |
tiered_pricing_table/ | F | ?Tip $tip, string $slug | Résoudre une astuce personnalisée de l’administration. |
API REST, import et export
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $fieldClasses | Classes (étendant ProductField) enregistrées comme champs produit de l’API REST WooCommerce. |
tiered_pricing_table/ | F | string[] $objectTypes, ProductField $field | Types d’objets REST auxquels le champ est ajouté (par défaut product, product_variation). |
tiered_pricing_table/ | F | array $columns | Colonnes proposées sur l’écran d’association de l’importeur CSV WooCommerce. |
tiered_pricing_table/ | F | array $headerToKey | Association automatique des en-têtes CSV aux colonnes. |
tiered_pricing_table/ | A | int $quoteRequestId | Une demande de devis a été enregistrée (les e-mails s’y accrochent). |
Intégrations
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | string[] $classes | Classes d’intégration de plugins (au démarrage : voir la note ci-dessus). |
tiered_pricing_table/ | F | array<string,string> $needleToClass | Intégrations de thèmes indexées par une aiguille en minuscules comparée au nom/modèle du thème (au démarrage). |
tiered_pricing_table/ | F | bool $supported, WC_Product $product | Indique si l’enrichissement du schéma SEO s’exécute pour les produits variables ; {slug} vaut yoast_seo, rank_math ou seopress. |
Vente en gros et boutique privée
Disponible depuis la version 8.0.0 ; l’inscription grossiste et la boutique privée font partie du plugin gratuit, les moyens de paiement et de livraison par rôle nécessitent la version premium. Le minimum de commande par rôle est devenu une règle de panier en 8.3.0 (voir les hooks order_discount/* sous Règles de tarification globales). Les e-mails sont des classes WC_Email standard (TPT_Wholesale_Admin_New_Application, TPT_Wholesale_Customer_Received, TPT_Wholesale_Customer_Approved, TPT_Wholesale_Customer_Rejected), enregistrées via woocommerce_email_classes et déclenchées via woocommerce_email_actions : tous les filtres d’e-mail de WooCommerce s’y appliquent donc.
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application | Une demande de compte grossiste a été envoyée ; le compte client existe à ce stade. |
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application, int $decidedBy | La demande a été approuvée et le client a le rôle grossiste. $decidedBy est l’identifiant de l’utilisateur qui a décidé, 0 pour une approbation automatique. |
tiered_pricing_table/ | A | int $applicationId, WholesaleApplication $application, int $decidedBy | La demande a été refusée ; le motif est enregistré avec la demande. |
tiered_pricing_table/ | F | bool $open | Renvoyez true pour garder la requête courante ouverte aux visiteurs alors que la boutique est fermée (s’exécute sur template_redirect après les exceptions intégrées). |
Réglages
| Hook | Type | Paramètres | Description |
|---|---|---|---|
tiered_pricing_table/ | F | SectionAbstract[] $sections | Onglets de réglages. |
tiered_pricing_table/ | F | array $fields | Champs de l’onglet Général (après la fusion des sous-sections). |
tiered_pricing_table/ | F | string[] $subsectionClasses | Sous-sections de l’onglet Général. |
tiered_pricing_table/ | F | array $fields | Champs du groupe Calcul des prix de l’onglet Général. |
tiered_pricing_table/ | F | array $fields | Interrupteurs des modules de l’onglet Avancé (appelé Outils avant 8.0.0). |
tiered_pricing_table/ | F | array $fields | Champs affichés après les modules dans l’onglet Avancé (avant Cache et Débogage). |
tiered_pricing_table/ | F | string[] $subsectionClasses | Classes de sous-sections ajoutées à l’onglet Vente en gros (8.0.0+). |
tiered_pricing_table/ | F | array<string,int> $order | Ordre des onglets de réglages (section id => priority). |
tiered_pricing_table/ | F | bool $premium | Indique si le configurateur de mise en page considère le site comme premium (déverrouille les contrôles réservés au premium). |
tiered_pricing_table/ | F | ?string $color | La couleur du thème détectée sur une installation neuve pour le palier actif (l’arrière-plan des boutons d’un thème de blocs, ou la couleur d’accent de Storefront, Astra, OceanWP et Flatsome). Renvoyez une couleur hexadécimale pour utiliser la vôtre, null pour la valeur neutre par défaut ; les couleurs sur lesquelles le texte blanc n’est pas lisible sont écartées. |
tiered_pricing_table/ | F | array<string,string[]> $styles | Styles de design masqués pour la grille de produits (layout => styles ; par défaut ['blocks' => ['style-8']]). |
tiered_pricing_table/ | F | array $rows | Lignes d’interrupteurs d’intégration. |
tiered_pricing_table/ | F | array<string,array> $categories | Groupes d’intégrations (id => ['title','description']). |
tiered_pricing_table/ | A | — | Après les champs de titres de colonnes. |
tiered_pricing_table/ | A | — | Fin du champ des titres de colonnes (l’interface des colonnes personnalisées s’y monte). |
Ressources
- Guide de l’utilisateur : documentation destinée aux propriétaires de boutique, pour chaque fonctionnalité.
- Guides : articles pratiques.
- Nous contacter : il manque un hook ou vous avez une question d’intégration ? Dites-le-nous.