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!' ); | |
} | |
} |
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 // only copy this line if needed | |
/** | |
* Change checkout URLs to product URLs for Facebook products | |
*/ | |
function sv_fbw_checkout_url_to_product( $product_data, $id ){ | |
$product_data['checkout_url'] = $product_data['url']; |
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 letters and envelopes to international services. | |
*/ | |
add_filter( 'wc_usps_services', function( $services ) { | |
$services['I_FIRST_CLASS']['services']['13'] = "First Class Mail® International Letters"; | |
$services['I_FIRST_CLASS']['services']['14'] = "First Class Mail® International Large Envelope"; | |
return $services; |
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 | |
/** | |
* Update Google client with your own application's cliend ID and secret from the Google Developer's Console. | |
*/ | |
add_action( | |
'woocommerce_bookings_update_google_client', | |
function ( Google_Client $client ) { | |
$client->setClientId( 'YourClientIDFromGoogleDevelopersConsole' ); | |
$client->setClientSecret( 'YourClientIDFromGoogleDevelopersConsole' ); |
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( 'wc_shipment_tracking_get_providers' , 'wc_shipment_tracking_add_custom_provider' ); | |
/** | |
* wc_shipment_tracking_add_custom_provider | |
* | |
* Adds custom provider to shipment tracking | |
* Change the country name, the provider name, and the URL (it must include the %1$s) | |
* Add one provider per line |
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
[ | |
{ | |
"all_day": true, | |
"cost": "100", | |
"customer_id": 1, | |
"date_created": 1551471271, | |
"date_modified": 1551593795, | |
"end": 1551571199, | |
"google_calendar_event_id": "uhd8bir3raajo4tco365foii1o", | |
"order_id": 154167, |