Categories
CMS Mastering Development Wordpress

WooCommerce with ACF: custom fields per product variation

I’m a little stuck here. So I have variable products and I need to show the output of a custom field in a custom tab. So I created a new field in ACF, called ‘test’. I’ve got this to work for the product itself, but the content does not change when I select another variable. […]

Categories
Mastering Development

Postgresql Select Rows where associated record with value X or Y does not exist

I have 3 tables: Table columns ——————— items id, name variations id, item_id images id, variation_id, type image has a variation and variation has an item I want to find items which don’t have images of type 4 or 5 (types are any integer 0..5 and cannot be null) The below query works however it […]

Categories
Mastering Development

woocommerce-how to add a number of products to the cart programatically?

I would like to add items inthe amount of product chosen by costumer every time the add to cart button is clicked, I tried to modify the number of products using woocommerce_add_to_cart_validation but with variable products it adds the variable product twice to the cart: function so_validate_add_cart_item( $passed, $product_id, $quantity, $variation_id = ”, $variations= ” […]

Categories
Development

Woocommerce: Detect where Add to Cart button was clicked and run different code

In the ecommerce store: There are items displayed on Homepage and each of the items have an “Add to Cart” button underneath them. When this button is clicked, the item is added to cart. If this button is clicked again, the Quantity of the item that is already existing in cart, is incremented by 1. […]

Categories
CMS Development Wordpress

developing a wordpress plugin, have a few PHP Woocommerce related coding questions

Background: I hired a programmer to create a schema markup plugin for me, the job was done but a few things have left that need to be added. We added a separate code where it adds fields such as “Brand” “MPN” and others to each product page. the user can then add his input and […]

Categories
CMS Development Wordpress

I need to restrict only one varient of variable product in cart woocomerce

I need to restrict only one varient of variable product in cart woocomerce . If same product from different variation is added it should remove old one and add new varient add_action( ‘woocommerce_add_to_cart’, ‘check_product_added_to_cart’, 10, 6 ); function check_product_added_to_cart($cart_item_key, $product_id,$quantity, $variation_id, $variation, $cart_item_data) { foreach( WC()->cart->get_cart() as $key => $item ){ // Check if the […]

Categories
Development Plugins WooCommerce Wordpress

Woocommerce – need a check $_POST product variables before add to cart button

I cant found good place in my custom plugin to put code for check of options chosed on product page. I’ve added some custom checkbox fields stored as $cart_item[‘saturday_option’] and $cart_item[‘Sunday_option’] (if checked = TRUE) I need a validator to check if customer set dates and options to exclude those days that sums into 0 […]