Frage

I am trying to add a variation product to my cart directly through a link. I am setting the variation_id with the query string. As far as I can tell I am sending the data the exact same way as the default variation product form does.

Here's the code inside of my single-product page:

<a href="<?php echo esc_url( $product->add_to_cart_url() ); ?>&variation_id=262" class="rounded-rect-button add-to-cart">Add to Cart</a>

Conversely, the simple product works fine. I have set prices to my product variations in the admin. Not sure why it's not as simple as sending the data through. Any help would greatly appreciated.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit wordpress.stackexchange
scroll top