-
AuthorPosts
-
March 17, 2016 at 1:37 am #599321
Hi,
When a shop product is added to cart it displays automatically a button ‘view cart’.
I would like to have another button (to the left of the existing) with a link to shop – ‘back to shop’.elpI appreciate your help
Kind Regards
March 17, 2016 at 5:58 pm #599830Hey Elsa!
Thank you for using our theme.
In the file plugins\woocommerce\includes\wc-cart-functions.php line 66 – 88 you find the function wc_add_to_cart_message.
At the end you find a call to the filter ‘wc_add_to_cart_message’:
wc_add_notice( apply_filters( 'wc_add_to_cart_message', $message, $product_id ) );Use this filter to add your button in $message.
Cheers!
GünterMarch 17, 2016 at 7:26 pm #599911Hi Günter,
Thanks for the reply.
I appreciate your tip, however with my basic knowledge of wordpress I limit myself only to look at the code without knowing what to do with it. :)March 19, 2016 at 12:01 pm #600661Hi!
Thank you for coming back.
Please add following code to Functions.php file of your child theme (or parent theme, if not using a child theme)- you can use Dashboard -> Appearance > Editor:
add_filter( 'wc_add_to_cart_message', 'my_wc_add_to_cart_message', 10, 2); function my_wc_add_to_cart_message( $message, $product_id ) { $message .= sprintf( '<a href="%s" class="button wc-forward my-button">%s</a>', esc_url( wc_get_page_permalink( 'shop' ) ), esc_html__( 'Back to shop', 'woocommerce' ) ); return $message; }In custom.css or Enfold -> General Styling -> Quick CSS field (or when using a child theme: in styles.css of the child theme or Enfold-Child -> General Styling -> Quick CSS field) put the following and adjust the values as needed:
a.my-button{ right: 250px !important; }Regards,
GünterMarch 20, 2016 at 6:03 pm #600860Hi Günter,
Stupendous!
Thanks for your help.Have a great day.
Elsa Soares
March 21, 2016 at 8:24 am #601102 -
AuthorPosts
- You must be logged in to reply to this topic.
