Dear @sahithk
Thank you for your question. Our developer has provided the following instructions to adjust the position of the Tabby promo snippet on the single product page:
- Current Placement:
By default, the snippet is added in the file includes/class-wc-tabby-promo.php
on line 6 using the action:
add_action('woocommerce_before_add_to_cart_form', array( CLASS, 'product_promotion') );
In WooCommerce templates (e.g., woocommerce/templates/single-product/add-to-cart/simple.php
), this corresponds to the following hook:
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
- Removing the Snippet from the Current Position:
To remove the snippet from this default position, add the following code to the functions.php
file in your theme:
add_action( 'plugins_loaded', 'move_tabby_product_promotion' ); function move_tabby_product_promotion() { if (class_exists('WC_Tabby_Promo')) { remove_action('woocommerce_before_add_to_cart_form', array( 'WC_Tabby_Promo', 'product_promotion') ); } }
- Adding the Snippet to a Custom Position:
To display the Tabby promo in a different position, use the following steps:
Add this line to your desired template location:
<?php do_action( 'tabby_product_promotion' ); ?>
Then, in the functions.php
file of your theme, add:
add_action('tabby_product_promotion', array( 'WC_Tabby_Promo', 'product_promotion'));
For example, your functions.php
file would look like this:
add_action( 'plugins_loaded', 'move_tabby_product_promotion' ); function move_tabby_product_promotion() { if (class_exists('WC_Tabby_Promo')) { remove_action('woocommerce_before_add_to_cart_form', array( 'WC_Tabby_Promo', 'product_promotion') ); add_action('tabby_product_promotion', array( 'WC_Tabby_Promo', 'product_promotion')); } }
If you have any further questions kindly contact [email protected]