• Resolved perlfan

    (@perlfan)


    Hi there, I’m trying to query an information (lead time) from the selected product variation. I understand that the variation ID can be retrieved only with JS query which works in the below code. My question is how I can include var_id into the php query wclt_get_lead_time( $variation_ID);. Is this possible / can someone help me?

    Thanks, Frank

    global $product;
    	   if ( $product->is_type( 'variable' ) ) {
    		  wc_enqueue_js( "
    			 $( 'input.variation_id' ).change( function(){
    				if( '' != $(this).val() ) {
    				   var var_id = $(this).val();
    				   alert('You just selected variation #' + var_id);
    				}
    			 });
    		  " );
    	   }
       
        $lead_time = wclt_get_lead_time( $variation_ID);
    • This topic was modified 2 years, 8 months ago by perlfan.
    • This topic was modified 2 years, 8 months ago by perlfan.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @perlfan

    Thanks for reaching out.

    As this is a development oriented topic, I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Lastly, for direct assistance with code customizations, I recommend consulting with the WooCommerce Customizations Partners. https://woocommerce.com/customizations/

    This specific forum is more focused on the default WooCommerce core features.

    Cheers

    Thread Starter perlfan

    (@perlfan)

    Ok, thank you! I’ll reach out to the other forums then. Thanks a lot. Frank

    You’re welcome!

    Feel free to create another topic if you have any other questions about core WooCommerce.

    Cheers

    Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources.

    I’ll go ahead and mark the thread as resolved but please feel free to create a new thread if you have further questions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get selected variation ID for php query’ is closed to new replies.