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
| /** | |
| * Remove product content based on category. | |
| */ | |
| function wb_remove_product_content() { | |
| // If a product in the 'Music' category is being viewed. | |
| if ( is_product() && has_term( 'Music', 'product_cat' ) ) { | |
| // Remove the images. | |
| remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); | |
| // For a full list of what can be removed please see woocommerce-hooks.php. | |
| } |
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
| /** | |
| * Auto Complete all WooCommerce orders. | |
| */ | |
| function wb_custom_woocommerce_auto_complete_order( $order_id ) { | |
| if ( ! $order_id ) { | |
| return; | |
| } | |
| $order = wc_get_order( $order_id ); | |
| $order->update_status( 'completed' ); |
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
| /** | |
| * Add a 1% surcharge to your cart / checkout. | |
| * change the $percentage to set the surcharge to a value to suit. | |
| */ | |
| function wb_woocommerce_custom_surcharge() { | |
| global $woocommerce; | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
| return; | |
| } |
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
| /** | |
| * Add a standard $ value surcharge to all transactions in cart / checkout. | |
| */ | |
| function wb_wc_add_surcharge() { | |
| global $woocommerce; | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
| return; | |
| } |
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
| /** | |
| * Add a 1% surcharge to your cart / checkout based on delivery country. | |
| * Taxes, shipping costs and order subtotal are all included in the surcharge amount. | |
| */ | |
| function wb_woocommerce_custom_surcharge() { | |
| global $woocommerce; | |
| if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { | |
| return; | |
| } |