Site logo

Archived topic

GP+Elementor Variations Problems

3 replies · Started by Felix on May 11, 2020

Viewing posts 1–4 of 4

Hello,

I've got a website made with GP+Elementor, and i used woocommmerce services to create a product gallery, without allowing users to buy directly in the web. I'd like to add variations on the products, but woocommerce says me I have to put a price on variations to make those variations to be visible on the particular product page.

At the same time, I cannot find the way to show those variations in the product page without using the add to cart widget, which is completly useless for me as I'm not using the cart page.

I hope your help,

Thank you!

Thank you David, that seems to fix the first problem. Any idea bout how to show those variations withot using add to cart?

Hmmm... yeah variations are part of the Cart form.
Try this:

1. Create a new Hook Element:

https://docs.generatepress.com/article/hooks-element-overview/

2. Add this top its content:

<?php
function db_list_woo_attributes() {
    global $product;

    if ( $product->get_type() == 'variable' ) {
        foreach ( $product->get_available_variations() as $key ) {
            $attr_string = array();
            foreach ( $key['attributes'] as $attr_name => $attr_value ) {
                $attr_string[] = $attr_value;
                echo '<span class="woo-attribute">' . implode( '',$attr_string ) . '</span>';
            }
        }
    }
}

// Call the attribute list
db_list_woo_attributes();

?>

Select the woocommerce_single_product_summary hook.
Check execute PHP
And set the display rules to Product > All Products

This archived topic is closed to new replies.