Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ahmedeshaan
Created April 1, 2021 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmedeshaan/453495f39d4e958eeabfde626ef1aa6c to your computer and use it in GitHub Desktop.
Save ahmedeshaan/453495f39d4e958eeabfde626ef1aa6c to your computer and use it in GitHub Desktop.
echo apply_filters(
'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
sprintf(
'<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="add_to_cart add_to_cart_button %s" %s>%s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() ),
esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '',
esc_html( $product->add_to_cart_text() )
),
$product,
$args
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment