2017-07-20 10 views

答えて

0

woocommerce /単一の製品/追加・ツー・カート/ variable.php

<?php 
if (is_product()) 
{ 
?> 
     <table class="variations" cellspacing="0"> 
      <tbody> 
       <?php foreach ($attributes as $attribute_name => $options) : ?> 
        <tr> 
         <td class="label"><label for="<?php echo sanitize_title($attribute_name); ?>"><?php echo wc_attribute_label($attribute_name); ?></label></td> 
         <td class="value"> 
          <?php 
           $selected = isset($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]) ? wc_clean(stripslashes(urldecode($_REQUEST[ 'attribute_' . sanitize_title($attribute_name) ]))) : $product->get_variation_default_attribute($attribute_name); 
           wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected)); 
           echo end($attribute_keys) === $attribute_name ? apply_filters('woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . esc_html__('Clear', 'woocommerce') . '</a>') : ''; 
          ?> 
         </td> 
        </tr> 
       <?php endforeach;?> 
      </tbody> 
     </table> 
<?php 
} 
?> 

woocommerce /グローバル/数量input.php

<?php 
if(is_product()) 
{ 
?> 
<div class="quantity"> 
<input type="number" class="input-text qty text" step="<?php echo esc_attr($step); ?>" min="<?php echo esc_attr($min_value); ?>" max="<?php echo esc_attr(0 < $max_value ? $max_value : ''); ?>" name="<?php echo esc_attr($input_name); ?>" value="<?php echo esc_attr($input_value); ?>" title="<?php echo esc_attr_x('Qty', 'Product quantity input tooltip', 'woocommerce') ?>" size="4" pattern="<?php echo esc_attr($pattern); ?>" inputmode="<?php echo esc_attr($inputmode); ?>" /> 
</div> 
<? } ?> 

woocommerce /単-product /アドオンに-カート/バリエーション-アドオンに-カート-button.php

<?php 
if(is_product()) 
{ 
?> 
<div class="woocommerce-variation-add-to-cart variations_button"> 
    <?php 
     /** 
     * @since 3.0.0. 
     */ 
     do_action('woocommerce_before_add_to_cart_quantity'); 

     woocommerce_quantity_input(array(
      'min_value' => apply_filters('woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product), 
      'max_value' => apply_filters('woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product), 
      'input_value' => isset($_POST['quantity']) ? wc_stock_amount($_POST['quantity']) : $product->get_min_purchase_quantity(), 
     )); 

     /** 
     * @since 3.0.0. 
     */ 
     do_action('woocommerce_after_add_to_cart_quantity'); 
    ?> 
    <button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html($product->single_add_to_cart_text()); ?></button> 
    <input type="hidden" name="add-to-cart" value="<?php echo absint($product->get_id()); ?>" /> 
    <input type="hidden" name="product_id" value="<?php echo absint($product->get_id()); ?>" /> 
    <input type="hidden" name="variation_id" class="variation_id" value="0" /> 
</div> 
<?php 
} 
?> 

カートに追加するフォントアイコンを追加

function filter_woocommerce_loop_add_to_cart_link($quantity, $product) 
{ 


    return sprintf('<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s"> 
    <i class="fa fa-shopping-cart"></i>&nbsp;&nbsp;%s</a>', 

    esc_url($product->add_to_cart_url()), 
    esc_attr(isset($quantity) ? $quantity : 1), 
    esc_attr($product->get_id()), 
    esc_attr($product->get_sku()), 
    esc_attr(isset($class) ? $class : 'button'), 
    esc_html($product->add_to_cart_text()),$product); 

}; 

add_filter('woocommerce_loop_add_to_cart_link', 'filter_woocommerce_loop_add_to_cart_link', 10, 2); 
関連する問題