Q
Q
q133z2020-07-18 19:35:53
WordPress
q133z, 2020-07-18 19:35:53

How to change the quantity of goods to 0 when selecting a certain attribute?

Hello, I am creating a site for the sale of paintings.
The painting can be purchased in different forms. For example original or digital copy.
The task is as follows:
If the buyer selects the attribute “buy the original or buy a copy with a license” from the product and pays, then the product should disappear from the site.
If you set the attribute "Manage inventory" in the product settings, then you simply cannot select this attribute, but the product remains.
I searched on Google and found nothing but this:

foreach ( $order->get_items() as $item_id => $item ) {
 	$variation_id = $item->variation_id;
 }

This code returns only the id of the variation and no more . The
question is how to implement this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question