jayukey
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Implement Quantity field behavior like in AmazonI believe this is the link: https://www.woothemes.com/products/minmax-quantities/
Thanks Mike.
Forum: Plugins
In reply to: [WooCommerce] Implement Quantity field behavior like in AmazonMike, Okay I will debug.. In the meantime can you share the link to the plugin? Thanks.
Forum: Plugins
In reply to: [WooCommerce] Implement Quantity field behavior like in AmazonI inserted code
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) {
in the function above so I can read what’s in cart for the variation id but I get fatal error.
Forum: Plugins
In reply to: [WooCommerce] Implement Quantity field behavior like in AmazonActually, I would like to do it programmatically but am unable to do it for a variation product …
Below is the code to do this for minimum qty … I want to do the opposite so in my function I want to read from cart and notify the user accordingly … for example if for a variation product of color blue there is already 5 items in cart and from product page user is adding 6 more then a notice will be sent to user that only 5 more of the blue colored variation product can be added.
function wpbo_minimum_item_quantity_validation( $passed, $product_id, $quantity, $variation_id, $variations ) {
// Make $woocommerce accessable
global $woocommerce;// Set a minimum item quantity
$minimum = 10;// Check if the quantity is less then our minimum
if ( $quantity < $minimum ) {// Get the product title for the error statement
$product = get_product( $product_id );
$product_title = $product->post->post_title;// Add the error
$woocommerce->add_error( sprintf( “You must add a minimum of %s %s’s to your cart to proceed.” , $minimum, $product_title ) );// If the quantity is 10 or above return true
} else {
return true;
}
}add_action( ‘woocommerce_add_to_cart_validation’, ‘wpbo_minimum_item_quantity_validation’, 1, 5 );
$passed_validation = apply_filters( ‘woocommerce_add_to_cart_validation’, true, $product_id, $quantity, $variation_id, $variations );
Forum: Plugins
In reply to: [WooCommerce] Implement Quantity field behavior like in AmazonThanks Mike for your reply. Also I want to restrict the addition to cart for a variation product when it reaches 10 quantity in cart.
Hi Sandeep,
Thank you for writing back to me. I’ve got in touch with Payumoney; will get back to you if I face issues while integrating it with my website.
Thanks,
JayP.S. registered myself on the official site http://wc-marketplace.com/ to post my future queries.