• Resolved alextribe

    (@alextribe)


    Hello,

    I want to ouput the variations dropdown and the buy button on a different section on my product page, preferably into a snippet, so I can use it with my wp bakery builder. I looked up the variable.php file in the woocommerce template files and copied the code into my snipped plugin.

    I call the function
    wc_dropdown_variation_attribute_options( array('options' => $options,'attribute' => $attribute_name,'product' => $product) );

    All variables are filled correctly, it shows the correct variation names in a label before the dropdown, but I get this error:
    Warning: in_array() expects parameter 2 to be array, object given in […]/wc-template-functions.php on line 2987

    It shows the dropdown, but just the first blank entry.

    If anybody has experienced this error and could help me, or has some tipps how to solve it myself, I would be very happy. I’m trying to solve this problem for the whole day and I’m out of ideas 🙁

    Thanks and have a good evening.

    Best regards
    Alex

    • This topic was modified 6 years, 1 month ago by alextribe.
    • This topic was modified 6 years, 1 month ago by alextribe.
    • This topic was modified 6 years, 1 month ago by alextribe.
Viewing 1 replies (of 1 total)
  • Thread Starter alextribe

    (@alextribe)

    Just solved it.

    I assigned $product->get_variation_attributes() to $attributes, but $product->get_available_variations() would be correct. Works now!

    Bst regards
    Alex

Viewing 1 replies (of 1 total)

The topic ‘Variations Dropdown Form as Snippet’ is closed to new replies.