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
//WP Query to get all bookable products of a vendor | |
$args = array( | |
'post_type' => 'product', | |
'author' => $vendor, | |
'meta_query' => array( | |
array( | |
'key' => '_wc_booking_availability', | |
'compare' => 'EXISTS', | |
), |
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
// Woocommerce | |
// Restrict customer to buy in only one shop | |
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart_with_variations' ); | |
function woo_custom_add_to_cart_with_variations( $cart_item_data ) { | |
//Compliant with product-variations | |
//Tested with woocoommerce 3.1 | WC Vendors PRO 1.4.3 | |
global $woocommerce; | |
$items = $woocommerce->cart->get_cart(); //getting cart items | |
$_product = array(); | |
foreach($items as $item => $values) { |