0

I need your expert advise.

How can I make Extra Product Options plugin and woocommerce talk to each other? Here is my situation.

I'm using woocommerce to create 50 products for a printing company customer. these product have many variations and product add-on options.

one product is "Business Cards" with quantities of 250, 500, 1000, 2500, 5000, 10000, 15000, 20000, 25000.

I have configure this product with woocommerce variable product and enter each quantity weight and dimension. this way my shipping plugin can create correct shipping rate. otherwise the shopper won't know shipping cost.

Im also using Extra Product Options plugin to configure additional product options. im using this plugin because with it I can set conditional logic. something wooocommerce variable product doesn't do.

I've set product options as follows:

Quantity: 250, 500, 1000, 2500, 5000, 10000, 15000, 20000, 25000. Size: 2x3.5 Printed Side: Front, Front & Back Printing Time: 4 Business Days, 2 business Days

here you can see the product link

https://selenethompson.com/product/business-cards/

[![Product Example][1]][1]

I've created a short script that will automatically select the identical variable quantity is woocommerce when the "quantity" option is selected in Extra Product Options plugin.. I inserted at the bottom of my child's theme footer and my script was working just fine until I updated woocommerce and Wordpress to its lates version.

below is the script I created.

    <?php
/**
 * The template for displaying the footer.
 *
 * @package flatsome
 */

global $flatsome_opt;
?>

</main><!-- #main -->

<footer id="footer" class="footer-wrapper">

    <?php do_action('flatsome_footer'); ?>

</footer><!-- .footer-wrapper -->

</div><!-- #wrapper -->

<?php wp_footer(); ?>

</body>
</html>
<?php
$currnt = $_SERVER['REQUEST_URI'];
$current = explode('/',$currnt);
if($current[2] == 'product'){ ?>
<script type="text/javascript">
jQuery( document ).ready(function() {
    var optionS = jQuery('select.quantity').val();
    var results = optionS.split('_');
        jQuery('select#pa_quantity').val(results[0]);
        jQuery('select#pa_quantity').change();
        //jQuery('.quantity.buttons_added .input-text.qty.text').val(results[0]);


    /*********
     * TO DISPLAY WOOCOMMERCE VARIABLE QUANTITY 
     * SIMPLE ADD TWO DIAGONAL LINES "//" 
     * BEFORE THE WORD"jQuery" in the line below 
     * **********/

        //jQuery('.variations_form table.variations').hide();

    jQuery('select.quantity').on('change', function () {
        var optionSelected = jQuery(this).val();
        var result = optionSelected.split('_');
        jQuery('select#pa_quantity').val(result[0]);
        jQuery('select#pa_quantity').change();
        //jQuery('.quantity.buttons_added .input-text.qty.text').val(result[0]);
    });
});
</script>
<?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.