I'm using the 3.9.3 version of Avada and the 2.5.5 version of WooCommerce.
How can I edit the fields that are in the checkout page?
I want to auto compile the email field with a saved cookie and make the email input readonly.
Is it possible? What files I need to edit?
Thanks.
You can do that in woocommerce templates (and also with some hooks).
For templates files, they are located in your woocommerce folder. You have to copy this templates directory inside your active theme (or child theme) and rename it woocommerce (if don't exist yet).
Inside the new directory woocommerce located in your active theme, go to checkout subfolder and you will find related php files, that you can edit to fit your needs.
After that if you need a specific hook, you can search in here (or post a related question, if it doesn't exist yet). Here you can fin an example of hook…
Related
I want to change the text at the checkout page below the returning customer bar, namely "If you have shopped with us before, please enter your details below. If you are a new customer, please proceed to the Billing & Shipping section.".
The text seems to be present in: plugins\woocommerce\i18n\languages\woocommerce.pot
and plugins\woocommerce\templates\checkout\form-login.php
I know I can simply adjust the text in those files; but if WooCommerce gets updated it will be overwritten.
Is there a way to change this text with hooks, although the text doesn't appear in my theme?
I don't want to use a plugin for this if possible.
When Overriding Woocommerce templates via a child theme (or a theme) you will not loose any changes when Woocommerce plugin is updated.
So in your case, as explained on the comment of the template checkout\form-login.php you will have to copy this file to your child theme:
/**
* Checkout login form
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-login.php.
Woocommerce templates are made to be overridden via a child theme (or theme)
See: WooCommerce action hooks and overriding templates
While working on a custom theme, you can achieve this functionality by copying same template to your-theme/woocommerce/checkout/form-login.php.
Now you can update plugin without losing the changes.
What i want is to edit a subscription in my account page of woocommerce. i have shared a picture below, of what exactly I want to edit.
This is the link of picture, what i want to edit is highlighted with red pen:
I want to edit the things which are highlighted with red pen. but i am unable to locate the exact page of this where i can edit things.
actually i want to change the link of update button in subscription table.
the URL of the page is like :
https://www.example.com/my-account/subscriptions/
There is no subscription page in pages menu of wordpress.
I am also unable to see this in endpoint of woocommerce.
Is there any way to do it ?
First have a look to that: Template structure & Overriding templates via a theme… It explains how to override correctly woocommerce templates via your active theme.
The templates that you will override have to be located in woocommerce folder inside your theme folder…
Now in the woocommerce-subscriptions plugin folder, you have also a template folder, and you can pick the necessary templates that you need to change, copying them into that woocommerce folder located in your theme, taking care to keep path (subfolder hierarchy)…
So you will copy from: wp-content/plugins/woocommerce-subscriptions/templates/myaccount(5 files inside)… to wp-content/themes/your-theme/woocommerce/myaccount (where your-theme is the folder name of your theme)…
Now you can edit templates just like the woocommerce ones…
The subscription end point is not listed in woocommerce as it's not a default end point
To rename the menu label for "Subscriptions", you can use this:
add_filter( 'woocommerce_account_menu_items', 'rename_my_account_menu_items', 0, 15 );
function rename_my_account_menu_items( $items ) {
// HERE set your new label name for subscriptions
$items['subscriptions'] = __( 'Custom label', 'woocommerce' );
return $items;
}
The code goes on function.php file of your active child theme (or theme) or in any plugin file.
Tested and working
I'm working with WooCommerce including the WooCommerzce Germanized Plugin.
The Plugin changes a lot of WooCommerce to make it safe for usage in Germany.
Now I need to modify a template file of the plugin. Whats the best way to make the changes? I don't want to modify the template itself to keep it safe for updates.
In order to override any WooCommerce plugin template you should create a folder in your active theme named after the plugin you are going to modify. Then follow the template folders structure ignoring just the folder templates and copy the desired file there.
For example, I needed to modify the WooCommerce Germanized Pro template based in /plugins/woocommerce-germanized-pro/templates/checkout/multistep/data.php. To modify it I have copied it to my theme: /themename/woocommerce-germanized-pro/checkout/multistep/data.php -- this way it will override an original template file.
Good luck!
I am using Woocommerce Projects plugin for WooCommerce and I have made some extra meta fields for the Projects.
But how can I display them on the place where I want them?
On this example page they show an option that will show it under the short description. But how can I change the location, to put it everywhere I want in the template file.
Update (see below: Overriding Projects template files safely)
What you are looking at, is this documentation, that lists all possible hooks with WooCommerce "Projects" plugin.
So you will have just change the hook in:
add_action( 'projects_after_loop_item', 'display_new_projects_fields', 10 );
Replacing 'projects_after_loop_item' by one of the hooks below to change the displayed location around the loop (for example):
projects_before_loop
projects_before_loop_item
projects_loop_item
projects_after_loop_item
projects_after_loop
Or also (with the other "Projects" plugin templates):
## General layout
projects_before_main_content
projects_after_main_content
projects_sidebar
## Archives
projects_archive_description
## Single Projects
projects_before_single_project
projects_before_single_project_summary
projects_single_project_summary
projects_after_single_project_summary
projects_after_single_project
Overriding Projects template files safely
Copy the templates directory located in projects-by-woothemes plugin folder to your active child theme directory (or active theme directory) and rename it projects.
Projects plugin will always check your theme for these files before displaying core templates as a fallback. Any template files found in the theme will be given priority and the core counterpart ignored.
Now you can edit any template file as you want, adding inside it this little peace of code (from the example), directly just where you want, displaying your custom field value, just using:
echo esc_attr( get_post_meta( $post->ID, '_location', true ) );
At the end, is better to keep in that folder, only the customized templates.
Reference and related:
Editing Projects Templates Safely
Overriding Templates via a Theme
I have build my own Wordpress theme and activated Woocommerce. Almost everypage works fine. But my Store and Product pages are not in Container. Also I would like to chanche the positions of sertain items on the Product Page. Theme is build in Bootstrap so I would like to use Bootstrapp to fix my Product page. The biggest problem is that I cannot find the right file to edit... Somebody got the solution?
You can check the site here.
Thanks!!
To build a WooCommerce Compatible theme, you need to edit the WooCommerce templates.
All the WooCommerce templates are located at woocommerce/templates folder. If you are not familiar with WooCommerce templates structure, you can install WooCommerce Template Hints, and it will display the template file name to show you where the content comes from.
To customize the template, please follow the best practices so your modifications will not be missing when you update WooCommerce.