AI Verified
Continue Shopping Button on Elementor Cart Page
Works well with the Elementor Cart Widget. Adds a 'Continue Shopping' button that can go back to your chosen URL
PHP
Voted: 0 by 0 user(s)
Scroll down to see more snippets from this codevault.
The author has indicated that this snippet is compatable up to wordpress version: 6.4
Our AI bot has checked this snippet is compatable up to wordpress version: 6.1
Free & Pro
Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.
Pro Only (Coming Soon)
You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.
Last modified:
04/03/2024
This snippet has the following status:
AI Verified
This snippet has been tested by our AI bot, see any comments below.
AI Bot Comments:
Found 0 vulnerabilities
0
3 months ago
This code snippet injects a styled "Continue Shopping" button after the cart totals on the WooCommerce cart page. It achieves this by utilizing the `add_action` function to hook a custom function (`cart_extra_text`) to the `woocommerce_after_cart_totals` action hook. Components: 1. Function: `cart_extra_text` This function is responsible for creating the button element and its styling. It doesn't take any arguments (`0` passed to `add_action`). 2. Styling (lines 1-21): The function first injects a `<style>` tag using `echo` (line 1). Within the `<style>` tag, it defines styles for the button element with the ID `#cart-extra-text a` (lines 3-21). Here's a breakdown of the styles: Lines 3-5: Set the button to display as a block-level element and occupy full width. Lines 6-8: Define background color (`#222222`), text color (`#FFFFFF`), and center text alignment. Lines 9-12: Add padding, set font size, weight, and transform text to uppercase. Lines 13-16: Remove underline, border, and set cursor to pointer on hover. Lines 17-20 (Optional): Add hover effect with a darker background color (`#FF0050`). 3. Button Creation (line 23): The function creates a `<div>` element with the ID `cart-extra-text` to contain the button (line 23). Inside the `<div>`, it creates an anchor (`<a>`) element with the following attributes: Text: "Continue Shopping" Href: Link to your desired "Continue Shopping" page (here, `https://learn.websquadron.co.uk/#join`) Target: Opens the link in a new tab (`_blank`) 4. Hooking the Function (line 25): The final line utilizes `add_action` to connect the `cart_extra_text` function to the `woocommerce_after_cart_totals` action hook. Parameters passed to `add_action`: `'woocommerce_after_cart_totals'`: The action hook triggered after cart totals are displayed. `'cart_extra_text'`: The name of the function to be executed. `10`: Priority (optional, set to 10 for execution after other functions with lower priority). `0`: Number of arguments the function expects (here, none). Overall Functionality: When the WooCommerce cart page renders, the `woocommerce_after_cart_totals` action is triggered. This calls the `cart_extra_text` function, which injects the styled button element after the cart totals. The button encourages users to continue shopping on your website. Customization: You can modify the button text (line 23) and link URL to suit your needs. Adjust the styles within the `<style>` tag (lines 1-21) to change the button's appearance. The priority (`10`) passed to `add_action` can be adjusted if you need the button to display before or after other elements hooked to the same action (experiment with different values).
Please see some snippets below related to this snippet..
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
this code add order note on a single product page and include information in order meta.
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
When adding or removing a product to or from the cart in WooCommerce, a message appears under the header letting the the user know the action has been successful. These messages are known as cart noti...
WooCommerce
AI Verified
Added: 1 year ago
Last Updated: 1 year ago
In some contexts, “coupon” is just the wrong word to use. For specifics, we have created a handful of guides on renaming coupon to the most popular synonyms. This guide in particular shows you how can...
These are some popular snippets from this users codevault..
Performance
AI Verified
Added: 1 year ago
Last Updated: 4 weeks ago
Remove Unused Javascript - and improve your Page Speed Insight Score
WooCommerce
Pro Verified
Added: 1 year ago
Last Updated: 2 days ago
Deactivate some WooCommerce Checkout Fields from showing
Elementor
AI Verified
Added: 7 months ago
Last Updated: 1 month ago
This can be used for any WordPress Builder to aid working with CSS Grids.
Category
Snippet Status