Skip to content

Commit

Permalink
WC: Replace Template With Filter
Browse files Browse the repository at this point in the history
Prompted by #447

This template isn't needed.
AlexGStapleton committed Jun 20, 2024

Verified

This commit was signed with the committer’s verified signature.
1 parent af4ab60 commit f09f703
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
@@ -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 f09f703

Please sign in to comment.