Is it possible to move the “remove product” link from the first <td>
in the cart under the quantity selector? And delete the first <td>
with it?
I found the funvtion in the template cart/cart.php
.
Unfortunately I couldn’t find any hooks to change the position or delete the <td>
.
Is there really no way to change that without touching/copy the template file?
This ist the <td>
with the quantity field:
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'woocommerce' ); ?>">
<?php
if ( ! $product_permalink ) {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ' );
} else {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
}
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
// Backorder notification.
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>', $product_id ) );
}
?>
</td>
I don’t want to touch the template because it’s the only detail that I want to change and couldn’t do at the moment. And for that “little” detail I don’t want to chage such a big and crucial template file. I don’t have to worry about future updates an newer versions of the file.
2
Answers
you can use jquery to do that
here it is
Please paste the below code in your current theme functions.php file.
I hope it will help you.