D
D
Dmitry2019-01-08 17:40:45
WordPress
Dmitry, 2019-01-08 17:40:45

Two add to cart buttons on WooCommerce?

At the moment, the product card looks like

spoiler
5c34b60a04162153633028.png

The task is to implement two buttons add to cart with different options.
spoiler
5c34b659e696b352247196.png

The question is, is it possible to do this? As I understand it, this is a variable product. It turns out that you need to broadcast hooks on it and change it there? Then how will all this be displayed in the admin panel?
If only to make sure that a button is added to each option, here I don’t understand how to implement this.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
coverme, 2019-01-10
@coverme

add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );

function my_extra_button_on_product_page() {
  global $product;
  echo '<a href="URL">Add to cart</a>';
}

P
Pychev Anatoly, 2019-01-08
@pton

Why so?
You can set your own price for each option
. And by choosing a variation, the user will select the quantity of this type of product at the corresponding price.

I
Igor, 2019-01-11
@xandri

I think it's easier to use the built-in way of product variabilitytyts
detailed guide
Displaying the price is provided, as well as changing the content
And if you absolutely need two buttons, then instead of the standard display of the list, display product variations with a "buy" link to each option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question