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
| function filter_upsells_product_display( $args ) { | |
| $args['orderby'] = 'title'; | |
| $args['order'] = 'ASC'; | |
| return $args; | |
| } | |
| add_filter( 'woocommerce_upsell_display_args', 'filter_upsells_product_display', 20 ); |
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_action( 'woocommerce_before_shop_loop', 'remove_woocommerce_shop_loop_item_title' ); | |
| function remove_woocommerce_shop_loop_item_title() { | |
| remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); | |
| } |
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
| $shipping_class_id = 464; | |
| $in_cart = false; | |
| foreach ( WC()->cart->get_cart_contents() as $key => $values ) { | |
| if ( $values[ 'data' ]->get_shipping_class_id() == $shipping_class_id ) { | |
| $in_cart = true; |
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
| /** | |
| * Change the placeholder image | |
| */ | |
| add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src'); | |
| function custom_woocommerce_placeholder_img_src( $src ) { | |
| $upload_dir = wp_upload_dir(); | |
| $uploads = untrailingslashit( $upload_dir['baseurl'] ); | |
| // replace with path to your image | |
| $src = $uploads . '/2012/07/thumb1.jpg'; |
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_action( 'wp_enqueue_scripts', 'woocomerce_infinite_scroll_shop_page' ); | |
| function woocomerce_infinite_scroll_shop_page() { | |
| if ( is_shop() ) { | |
| wp_enqueue_script( 'infinite-scroll', get_stylesheet_directory_uri() . '/js/infinite-scroll.pkgd.min.js', array( 'jquery' ), '1.0.0', true ); | |
| wp_enqueue_script( 'infinite-scroll-set', get_stylesheet_directory_uri() . '/js/infinite-scroll-set.js' , array( 'jquery', 'infinite-scroll' ), '1.0.0', true ); | |
| } |
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_filter( 'woocommerce_coupons_enabled', 'disable_coupon_field_on_cart_checkout' ); | |
| function disable_coupon_field_on_cart_checkout( $enabled ) { | |
| if ( is_cart() || is_checkout() ) { | |
| $enabled = false; | |
| } | |
| return $enabled; |
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_action( 'template_redirect', 'sumup_redirect_order_received'); | |
| function sumup_redirect_order_received(){ | |
| if ( is_wc_endpoint_url( 'order-received' ) ) { | |
| global $wp; | |
| $order_id = intval( str_replace( 'checkout/order-received/', '', $wp->request ) ); | |
| $order = wc_get_order( $order_id ); |
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_filter( 'woocommerce_product_get_tax_class', 'woocommerce_different_tax_rate_user_role', 1, 2 ); | |
| add_filter( 'woocommerce_product_variation_get_tax_class', 'woocommerce_different_tax_rate_user_role', 1, 2 ); | |
| function woocommerce_different_tax_rate_user_role( $tax_class, $product ) { | |
| $user_id = get_current_user_id(); | |
| $user = get_user_by( 'id', $user_id ); | |
| if ( is_user_logged_in() && ! empty( $user ) && in_array( 'customer-tax-exempt', $user->roles ) ) { | |
| $tax_class = 'zero-rate'; |