質問

I would like to display my add to cart doem in a modal but doing so make a part of becomes missing. I have variable products and the select field corresponding to the variation options is missing

Here is how i call the Add to cart form in my child theme :

 <div id="buyModal" class="modal"> 
    
      <div class="buyModal-content">
        
        <?php  woocommerce_template_single_add_to_cart(); ?>
        
        <a href="javascript:;" class="close_btn_subsciption">X</a>
      </div>
        
    </div>
役に立ちましたか?

解決

I have replaced woocommerce_template_single_add_to_cart(); by this

 global $product; 

  if( is_a( $product, 'WC_Product_Variable' ) ){
  
        woocommerce_variable_add_to_cart();
          
        } else {
          
            woocommerce_simple_add_to_cart();
          
        }

and it worked as i wanted.

ライセンス: CC-BY-SA帰属
所属していません wordpress.stackexchange
scroll top