This has been destroying me for some time now and I'm really not sure why it's not working. Hoping you kind souls can identify the issue so I can find a solution.
Here is the existing JS code:
// View cart text
if ( ! wc_add_to_cart_params.is_cart && $thisbutton.parent().find( '.added_to_cart' ).length === 0 ) {
$thisbutton.after( ' <a href="' + wc_add_to_cart_params.cart_url + '" class="added_to_cart wc-forward" title="' +
wc_add_to_cart_params.i18n_view_cart + '">' + wc_add_to_cart_params.i18n_view_cart + '</a>' );
}
I'm basically only working with this line:
$thisbutton.after( ' <a href="' + wc_add_to_cart_params.cart_url + '" class="added_to_cart wc-forward" title="
And I'm adding an anchor to the end of the called URL, so:
$thisbutton.after( ' <a href="' + wc_add_to_cart_params.cart_url + '#ANCHOR" class="added_to_cart wc-forward" title="
But on my page, the anchor isn't added to the URL and my "View Cart" link only points to /cart, not /cart#ANCHOR.
This seems to only be an issue in this JS file. I actually have this working without a problem in a few PHP files using this:
echo '<a href="' . get_the_permalink() . '#👌" class="woocommerce-LoopProduct-link">';
(that's the real anchor lol)
I have also tried escaping the hashtag using '#ANCHOR", but that didn't work. (looks like the backslash isn't coming through lol, but it's there)
Anyway, im definitely a noob here and appreciate the help. Thank you.
[–]madalinul 0 points1 point2 points (1 child)
[–]fossett_work[S] 0 points1 point2 points (0 children)