View disable_coupon_field_on_cart_checkout.php
This file contains 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; |
View Redirect to Order Received Page After Sumup Payment.php
This file contains 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 ); |
View woocommerce_different_tax_rate_user_role.php
This file contains 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'; |
View hide_out_of_stock_exclude_category.php
This file contains 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( 'pre_option_woocommerce_hide_out_of_stock_items', 'hide_out_of_stock_exclude_category' ); | |
function hide_out_of_stock_exclude_category( $hide ) { | |
if ( is_product_category( 'fashion' ) ) { | |
$hide = 'no'; | |
} | |
return $hide; | |
} |
View wc-custom-archive-template.php
This file contains 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( 'template_include', 'custom_product_cat_template', 99 ); | |
function custom_product_cat_template( $template ) { | |
if ( is_product_category('shoes') ) { | |
$new_template = locate_template( array( 'custom-archive.php' ) ); | |
if ( '' != $new_template ) { | |
return $new_template ; | |
} | |
} |
View Var Dump Single Product Page Data Keys, Values.php
This file contains 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( 'loop_start','get_single_product_page_data' ); | |
function get_single_product_page_data() { | |
if ( ! is_product() ) | |
return; | |
$product = wc_get_product( get_the_ID() ); | |
$data = $product->get_data(); | |
View woocommerce_thankyou_page_data.js
This file contains 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
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
var order_id = { | |
"id": 111568, | |
"parent_id": 0, | |
"status": "processing", | |
"currency": "USD", | |
"version": "8.0.3", | |
"prices_include_tax": false, | |
"date_created": { |
View woocommerce_product_backorders_allowed.php
This file contains 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_backorders_allowed', 'woocommerce_product_backorders_allowed', 10, 3 ); | |
function woocommerce_product_backorders_allowed( $backorder_allowed, $product_id, $product ){ | |
if ( current_user_can('wholesaler') ) { | |
$backorder_allowed = true; | |
} else { | |
$backorder_allowed = false; | |
} | |
return $backorder_allowed; | |
} |
View child-category-template.php
This file contains 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( 'category_template', 'custom_subcategory_template' ); | |
function custom_subcategory_template( $template ) { | |
$cat = get_queried_object(); | |
if ( isset( $cat ) && $cat->category_parent ) { | |
$template = locate_template( 'sub-category.php' ); | |
} |
NewerOlder