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
// Enable subscription-related emails on a staging site | |
if ( ! defined( 'WCS_FORCE_EMAIL' ) ) { | |
define( 'WCS_FORCE_EMAIL', true ); | |
} |
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
<?php | |
// Sets when the session is about to expire | |
add_filter( 'wc_session_expiring', 'woocommerce_cart_session_about_to_expire'); | |
function woocommerce_cart_session_about_to_expire() { | |
// Default value is 47 | |
return 60 * 60 * 47; | |
} |
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( 'wcpv_vendor_slug', 'change_product_vendors_slug' ); | |
function change_product_vendors_slug() { | |
return 'your-new-slug'; | |
} |
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( 'wc360_js_playspeed', 'adjust_play_speed_for_wc360' ); | |
function adjust_play_speed_for_wc360( $speed ) { | |
return 750; | |
} |
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
<?php | |
add_filter( 'woocommerce_csp_conditions', function( $condition_classes ) { | |
class WC_CSP_Condition_Package_Item_Quantity_Bottles extends WC_CSP_Condition_Package_Item_Quantity { | |
public function __construct() { | |
parent::__construct(); | |
$this->id = 'bottles_in_package'; | |
$this->title = __( 'Bottles Count', 'woocommerce-conditional-shipping-and-payments' ); | |
} |
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
<?php | |
add_action( 'woocommerce_store_api_checkout_update_order_from_request', 'woo_blocks_address_field_validation', 10, 2); | |
function woo_blocks_address_field_validation( WC_Order $order, $request ) { | |
$shipping_address = $order->get_address('shipping')['address_1']; | |
$billing_address = $order->get_address('billing')['address_1']; | |
if ( $shipping_address && ! preg_match( '/[0-9]+/', $shipping_address ) ) { | |
throw new Exception( 'Your shipping address must contain a house number!' ); | |
} |
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
<?php | |
add_action( 'woocommerce_store_api_checkout_update_order_from_request', 'woo_blocks_address_field_validation', 10, 2); | |
function woo_blocks_address_field_validation( WC_Order $order, $request ) { | |
$billing_address = $order->get_address('billing')['address_1']; | |
if ( $billing_address && ! preg_match( '/[0-9]+/', $billing_address ) ) { | |
throw new Exception( 'Your billing address must contain a house number!' ); | |
} | |
} |
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
<?php | |
add_action( 'woocommerce_store_api_checkout_update_order_from_request', 'woo_blocks_address_field_validation', 10, 2); | |
function woo_blocks_address_field_validation( WC_Order $order, $request ) { | |
$shipping_address = $order->get_address('shipping')['address_1']; | |
if ( $shipping_address && ! preg_match( '/[0-9]+/', $shipping_address ) ) { | |
throw new Exception( 'Your shipping address must contain a house number!' ); | |
} | |
} |