[Support request] GP+Elementor Variations Problems

Home Forums Support GP+Elementor Variations Problems

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1278684
    Felix

    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!

    #1279061
    David
    Staff
    Customer Support
    #1279289
    Felix

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

    #1279351
    David
    Staff
    Customer Support

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.