Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pprince3145

    (@pprince3145)

    I am calling the snippet as a shortcode via Elementor

    this where the plugin and function are defined

    this is the function I’m trying to call in the snippet

    I hope that helps, thank you

    Thread Starter pprince3145

    (@pprince3145)

    sadly that didn’t work

    all that did was allow me to save the snippet. Not finding the function declared in a working plugin is still the issue

    I’m sure the snippet is executing before the plugin declares the function but I have no idea how to resolve that or if it can be

    thank you

    Thread Starter pprince3145

    (@pprince3145)

    Thank for your prompt response

    I’ve commented where the unrecognised function is called

    <form id="calcForm" class="calcForm-container"> 
    <label class="calcformLabel">Bike Type:</label>
    <select id="sku" name="sku" form="calcForm">
    <?php

    // Query Posts.

    // Query arguments.
    $query_args = array( 'post_type' => array('product', 'product_variation'),
    'order' => 'ASC',
    'orderby' => 'ID',
    'posts_per_page' => -1, // Get all products
    );

    // Run the query.
    $query = new WP_Query( $query_args );

    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post();
    $product = wc_get_product(get_the_ID());
    $sku = $product->get_sku();
    $name = $product->get_name();

    $role_based_price = get_price_of_product($product); // this is the function that cannot be found when the snippet is saved


    if($sku !== "")echo "<option value=\"" . $sku . "|" . $role_based_price . "\">" . $name . "<option>\n";
    }
    }

    // Reset post data.
    wp_reset_postdata();
    ?>
    </select>
    <label class="calcformLabel">Delivery Postcode:</label>
    <input type="text" class="calcformInput" id="delivery_postcode" name="delivery_postcode" placeholder="Enter delivery postcode">
    <button class="calcformlabel" type="button" id="calculate" onClick="calcformSubmit()">Get Quote</button> </form>

Viewing 3 replies - 1 through 3 (of 3 total)