Open cart page in new tab - wordpress

I need code to open a cart page in a new tab (nofollow) when I use the button located in the mini cart and the button that appears after a product is added.
WordPress and Woocommerce do not offer such an option. I couldn't find such code anywhere, and I don't have the knowledge to write one. Can somebody help me?

Use JavaScript's window.open function.
Here is an example using HTML and JavaScript:
<button
onclick="window.open('https://www.yourwebsite.com/shoppingCart')">
Shopping Cart
</button>
Inline JavaScript is not recommended but, since this is just a very simple example, I think it's acceptable.

Related

BigCommerce Back button needed

Is there some way that we can possibly incorporate/code a simple old style universal 'Back' button on all our product pages?
BigCommerce only allows for a standard breadcrumbs trail below the main menu that is not intuitive or user friendly for many visitors.
A visitor will either use our main PARTS menu page or the search function to check out many individual parts and then want to go straight back to the PARTS menu or at least the last 'group' results from their search and an obvious and plain old 'Back' button right next to the part would be an asset.
Any advice would be greatly appreciated.
If you add something similar to the below example to your product page template (wherever you want to add it), you can achieve it.
<button onclick="window.back.history(-1);"> Back Button </button>
It's inline javascript, which is not the best way to do it, but it will work. For more, you will need to add custom js file and do everything there.

WP Woocommerce show popup add to cart button

I am using woocommerce and a plugin called fancy product designer.
The plugin allows you to custom design products and them order them using woocommerce.
Everything is working fine but I need to add a feature which displayed a bootstrap modal after clicking the add to cart button. This modal will contain a preview of the designed product and have a button which will add it to your basket and then reload the page.
I can create the code to display the preview I just need to know how to add the functionailty to display a custom modal which contains an add to cart button
Requirements:
Rename the add to cart button to "preview"
When "preview" button is clicked open a bootstrap modal
The modal contains the add to cart button which adds the product to your cart.
It would be great if you could also share where I should add the modal code and the js code to open the modal.
I am using a plugin called "insert header and footer" which I can use to add the js code which opens the preview modal but if you have a better way please share.
Here is the URL to one of the product pages: https://peppyplates.brookstonesites.co.uk/product/girl-christening/
I haven't tried anything so far as I don't know how to code in wp that well but here is an example of what I would do if it was raw PHP.
$('#preview_button').click(function() {
$('#preview_modal').modal('show')
});
$('#add_to_cart_button').click(function() {
// WP code to add the product to the cart
}
It would be great to know where I should put my html bootstrap modal code as well. I don't want to edit the plugin directly since if it gets updated the code will be wiped

Pop-up text on image click WordPress

I am designing a wordpress site for a friend. He wants the bio text to appear after clicking on necessary image. I noticed this is straight forward with Elementor Pro. I want to keep things free for him at the mo.
I am running the Astra theme with basic Elementor. I also know how to code so if you think this is a custom css job then let me know the work around. (I'm brand new to WP)
Many thanks
Try adding an onclick event to the image and write some java script to add text where you want or may be enable a hidden textarea ??
You can check this link below for reference
How do I add a .click() event to an image?

How can I load post/page via ajax?

I know this has been done before, but I can't find any tutorial or article on the subject.
I have a normal menu in a widget, each menu item pointing to a different post/page. I also have an empty div where the post should be loaded.
<div id="ajax_content"></div>
I just want to be able to load the post in that div whenever a menu item is clicked.
How can I do that?
Any tutorial or article that explains how this is done?
Does a plugin exist that accomplishes this?
Thank you.
This AJAX Tutorial by Pippin Williamson on WP Back end AJAX helped me a lot on how AJAX works in WP.
He shows how to show top 5 posts via AJAX in the WP Backend by clicking a button. I'm sure you can manipulate the code and make it help you in your case.
The difference is just that you need to load the scripts on the front end by using wp_enqueue_script instead of admin_enqueue_scripts
Hope this helps ..

Need a next post button for wordpress

I am working on a blog and wanted to add a next post button somewhere between every post like this website. http://dose2fun.com
any way to add the button there?
I dont have same to same solution, but you can use jj-wp easy navigation. It will add previous and next post button. It can be controlled by keyboard too.

Resources