Created
September 21, 2017 18:38
-
-
Save rayflores/cf9c3e2645690d4941142bc2ec78419d to your computer and use it in GitHub Desktop.
WooCommerce Rearrange Product Addons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: WooCommerce Rearrange Product Addons | |
| */ | |
| $GLOBALS['Product_Addon_Display']; // get globals | |
| // if variations - remove from single variation hook | |
| function remove_plugin_actions(){ | |
| remove_action( 'woocommerce_single_variation', array( $GLOBALS['Product_Addon_Display'], 'display' ), 15); | |
| } | |
| add_action('woocommerce_single_variation','remove_plugin_actions'); | |
| // if variations - remove from displaying at all | |
| function remove_display(){ | |
| remove_action( 'woocommerce_before_variations_form', array( $GLOBALS['Product_Addon_Display'], 'reposition_display_for_variable_product' ), 10 ); | |
| } | |
| add_action('woocommerce_before_variations_form','remove_display'); | |
| // add display where you want to ( | |
| /* TODO: add settings to get hook here */ | |
| function add_display(){ | |
| $GLOBALS['Product_Addon_Display']->display(); | |
| } | |
| add_action( 'woocommerce_before_add_to_cart_button', 'add_display' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment