Skip to content

Commit

Permalink
Merge pull request #448 from siteorigin/wc-remove-add-to-cart-template
Browse files Browse the repository at this point in the history
 WC: Replace Template With Filter
  • Loading branch information
AlexGStapleton authored Jun 21, 2024
2 parents 8230901 + f09f703 commit daca571
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 36 deletions.
20 changes: 20 additions & 0 deletions woocommerce/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,23 @@ function siteorigin_north_wc_cart_wrapper_close() {
}
}
add_action( 'woocommerce_after_cart_table', 'siteorigin_north_wc_cart_wrapper_close' );

function siteorigin_settings_override_add_to_cart_btn( $btn, $product, $args = [] ) {
$args = wp_parse_args( $args, [
'quantity' => 1,
'class' => 'button'
] );

$new_btn = sprintf(
'<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s"><span class="north-icon-cart" aria-hidden="true"></span> %s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( $args['quantity'] ),
esc_attr( $product->get_id()),
esc_attr( $product->get_sku() ),
esc_attr( $args['class ']),
esc_html( $product->add_to_cart_text() )
);

return $new_btn;
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'siteorigin_settings_override_add_to_cart_btn', 10, 3 );
36 changes: 0 additions & 36 deletions woocommerce/loop/add-to-cart.php

This file was deleted.

0 comments on commit daca571

Please sign in to comment.