Edit Download Link on Woocommerce thank you page - wordpress

I'm trying to work out how to edit the download button link that sits directly underneath the order title, in the order details section of the thank you page.
So if you make an order in Woocommerce, for a product that is downloadable, you get a "Thank you. Your order has been received" box, then under it, you get an "Order Details" box.
In that order details box, it shows each product ordered, and if that product is downloadable, it shows a small "Download: Product name" link under the product title.
I want to hook/filter into that download link, and edit it ( changing the text mainly, but also restyling it).
I've tried finding the action that adds it, but can't seem to work out where it's based, and then how to filter into it to change it's appearance. I did also try to add a function that include a different download link using woocommerce_order_item_meta_end, then hide the old link, but can't work out how to get the product download link URL either.
Any help would be great, thanks!

There doesn't seem to be any filters to do that so you'd need to copy the \templates\order\order-downloads.php template file into your child theme folder and make modifications to the following line in that file.
case 'download-file':
echo '' . esc_html( $download['download_name'] ) . '';
break;

Related

Change a text on a woocommerce website using code

I'm trying to change the english text "By submitting this form, you hereby agree that we may collect, store and process your data that you provided" in the bottom of the page with something else in Arabic. I'm using Wordpress with Woocommerce plugin and divi theme builder.
this is the url of the page i'm trying to edit (https://blockchainarabi.com/checkout/)
There are 2 methods; using plugin and manually! Change a text on a woocommerce website using code is a manual method!
I'd suggest, use Google Fonts and text for your site. As there are numerous beautiful fonts that Google provides which improves user experience and helps you to boost user engagement.
Just follow the below-mentioned steps:
Steps:
Step 1: Find the fonts that you want to use on your website.
Step 2: Then, select the fonts by clicking on a plus sign (+) icon, You will see this in the top right section of every font family box.
Step 3: A Family Selected tab will appear on the bottom side, Just click it there and then click on customize and then, modify and select the different styles of fonts.
Step 4: Then, Go to Embed and copy the Standard field URL. You can see in the image.
enter image description here
Step 5: Next, in the process is to add the following code into functions.php file via FTP client.
function wpblog_add_google_fonts() {
wp_enqueue_style( ' wpblog_google_fonts ', ' https://fonts.googleapis.com/css...', false );}
add_action( 'wp_enqueue_scripts', 'wpblog_add_google_fonts' );
then save it.
See, it's that simple!
Note: Don’t forget to change the URL link with your own

How to allow only 1 attachment for each post and make it a requirement for each post?

I am currently attempting to configure the settings of attachments to make it required and only one attachment attached to a post but all my changes did not have any good results.
I have looked into adding an action to attachment_register function and some documentation about attachments in Wordpress but still no positive results.
Personally, I would go with the ACF (Advanced Custom Fields) plugin to accomplish this.
You can use the plugin add a new required media upload (picture/file) meta field for posts.
In the settings for this new Custom Field group, you also use the plugin to remove the default "featured image" field from the edit post screen, to force the user to use your new required media upload function.
All that said, you will probably need to make adjustments to your theme template files to use the ACF functions to display the data on your site. This will probably be pretty straight forward as long as you have ability to alter you theme template files.
Hope that helps!
Building on Mike C's answer in regards to using ACF (Advanced Custom Fields) with a step by step walkthrough of how to achieve such a thing.
Install the Advanced Custom Fields Plugin
Once Activated you will see a new section in the Wordpress Left Menu
Click Custom Fields
First we need a field group, click Add New
Name this something relevant such as "Page Attachment"
Now Click Add Field and Fill out the fields, example below:
Field Label: Upload Attachment
Field Name: page_attachment
Field Type: File
Return Value: If you want someone to click a link to download, select File URL
Scroll Down To The Section Titled Locations
You mentioned that this should be on posts so I would recommend the below selections:
Post Type -> Is Equal To -> Post
Click Save/Update
Go To A Post, you will now see a button that reads Add File, you cannot update/create a post without having a file attached.
This is the admin work completed now we need to make the file appear in the post.
Now if you want the file to appear at the end of the post, under the header or even in the sidebar that is fine. Simply add the following code:
<p><a href="<?php the_field('page_attachment');?>" title="<?php the_title();?>">
Download Attachment
</a></p>
Obviously this is just a link that it echos, so this could be added to an image to make it seem a little more stylish, it's up to you. But this is the simple way of adding a file.
Now if you wanted to add this into the page content midway, you would either need to make a shortcode function to display it. Or you could add something like:
Download Now
And then add the following to the bottom of your post:
<p id="attachment"><a href="<?php the_field('page_attachment');?>" title="<?php the_title();?>">
Download Attachment
</a></p>
This means, whenever some clicks on the link that takes them to #attachment, it will jump them down to the bottom of the post where the download link is.
Any questions, let me know.

Woocommerce add to cart and redirect to Custom URL - Different for each link

So I am using a link on this page: https://www.revealio.com/make-brand-come-alive/ (yellow button).
The link is supposed to add the product to the cart and then send them to the next step in the sales funnel.
For the link URL I used:
https://www.revealio.com/help-creating-video?add-to-cart=4951
and
https://www.revealio.com/help-creating-video?add-to-cart=4951&quantity=1
Full link code is:
YES! MAKE MY BRAND COME ALIVE!
I found this code here: https://businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/
If you need to see the cart (we are still redesigning these pages) you can go here in a seperate browser tab to see how it updates: https://www.revealio.com/cart/
The problem is that it is adding 2 products to my cart instead of 1.
How can I get this to just add one of my products to the cart and move on?
Here is something new I found out. If I just go directly to the link it only adds one product. If I click on the link in the page (https://www.revealio.com/make-brand-come-alive/) it adds 2 products. It does the same for a button or a text link.
Use the shortcodes provided by WooCommerce to render the add to cart links. https://docs.woocommerce.com/document/woocommerce-shortcodes/
[add_to_cart_url id="99"]
I found it!
It needs a / before the ?
https://www.revealio.com/help-creating-video/?add-to-cart=4951
I was using: https://www.revealio.com/help-creating-video?add-to-cart=4951 which gave two item in the cart.

Woocommerce - Filtering products based on attribute

I was hoping someone could help me, I'm trying to create a filtering menu for product attributes. I have the attributes being listed out just fine but when you click on them they take you to the 'Archive' page which lists the correct products. Now is there anyway I can make it so when the user click on an attribute it shows the filtered products but using the 'shop' template/page. So not linking to the archive page??
Any ideas?
I have looked into the Layered Nav widget, its closed to what I'm wanting but I don't like how you can select multiple attributes. I just want it to do i one by one.
thanks guys/gals
This page has an answer: http://docs.woothemes.com/document/using-custom-attributes-in-menus/
At the bottom you'll see how to create a proper template for selected attributes pages.
Notice that your taxonomy-product_cat.php copy should be put into your theme folder, not to woocommerce folder in your theme.
It works for me.

meta box for header

I actually searched on the web about meta boxes but didnt find the thing I want since they were page and post specific . So I am actually searching for a thing(meta box or whatever) which will provide me a simple text field in the admin panel and when I enter the link of the youtube video and hit submit the video would appear in the HEADER of my blog . So which tool will let me to do the thing I described ?
It is actually "custom fields" what I meant here . For each post you can add a custom field and in the header you can use each's value via 'get_post_custom_values' function .

Categories

Resources