나는 WooCommerce 장바구니 탭을 사용합니다. 제품에 제거 버튼을 추가 할 수 있습니까? wp-content/plugins/woocommerce/templates/cart
오픈 mini-cart.php
에Woocommerce sliding cart - 각 제품에 대한 제거 단추 추가
이동 :
나는 WooCommerce 장바구니 탭을 사용합니다. 제품에 제거 버튼을 추가 할 수 있습니까? wp-content/plugins/woocommerce/templates/cart
오픈 mini-cart.php
에Woocommerce sliding cart - 각 제품에 대한 제거 단추 추가
이동 :
그것은이 작업을 수행하는 것은 매우 간단합니다. li
태그 내부에 다음 코드를 추가합니다
<?php
echo apply_filters('woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">×</a>', esc_url($woocommerce->cart->get_remove_url($cart_item_key)), __('Remove this item', 'woocommerce')), $cart_item_key);
?>
이것은 당신의 슬라이딩 카트에 각 제품에 대한 삭제 버튼 (A X)를 추가합니다.
이제 끝났습니다.
echo apply_filters('woocommerce_cart_item_remove_link',
sprintf('<a href="%s" class="remove" title="%s">×</a>',
esc_url(WC()->cart->get_remove_url($cart_item_key)),
__('Remove this item', 'woocommerce')), $cart_item_key);
가 WC()->cart
대신 희망 $woocommerce->cart
의 위의 솔루션 중 하나를 작동하지 않는 경우이 다른 사람을 도울 수 있습니다 :
다니엘의 솔루션이 작동하지 않았다 나를 위해, 다음 코드는 일을했다 :)
이것은 나를 위해 sprintf와'에코 apply_filters ('woocommerce_cart_item_remove_link'('×', esc_url (WC() 작동하지 않았다 -> cart-> get_remove_url ($의 cart_item_key)) __을 ('이 항목 삭제', 'woocommerce')), $ cart_item_key); '트릭을 수행했습니다. '$ woocommerce-> 장바구니 ...'대신'WC() -> 장바구니 ... '에주의하십시오. 위의 해결책이 작동하지 않는다면 다른 사람에게 도움이되기를 바랍니다. :) –