Hi i'm creating a webshop with WooCommerce but with a self made theme, now showing the content-single-template works fine, however the cart/checkout page is not working. This is what i've done so far:
• Add woocommerce.php in the root of my theme with woocommerce_content() inside.
• Created "woocommerce" directory in the root of my theme inside this directory another one "checkout" and inside there my custom form-checkout.php
• Shortcodes on every page are included
• Clean install WooCommerce
• Flushed permalinks
I've read trough this article from WooCommerce on how to integrate it and followed every step precisely.
When i switch to a differend theme it does show the cart/checkout page so wondering what i'm overseeing here.
Thanks
EDIT:
Contents: woocommerce.php
<?php
get_header();
woocommerce_content();
get_footer();
Got it fixed, because i basically created my own theme i started switching theme's and see the difference between mine and the working theme.
What fixed it for me was in content.php placing this:
<?php the_content(); ?>
The Proper way to work with WooCommerce Templates is, Copy the templates folder from your /wp-content/plugins/woocommerce/templates/ and paste it in your theme like /wp-content/themes/your-theme/ and rename it to /woocommerce/ So It would be like this
/wp-content/themes/your-theme/woocommerce/ and then you can edit the templates and change the UI.
Related
I'm trying to have a pagination on my custom Products page that is not the default one in Woocommerce.
I used Elementor to customize this page and after some research I saw that I could call a function that is already integrated in WordPress using the < paginate_links > function.
The only problem is that I have no idea where to call this function in order to have a pagination on my product page.
To be more precise, i would like to know where exactly i have to change or add my php functions, and what code should i use to get my pagination.
Normally it is in the archive.php or a version of that file name specific to your post-type. But before you go and change it, create a child theme in case you haven't done that already. In the child theme folder, you then duplicate the archive.php or similar to make it overwrite the one from the parent theme. This way you keep your version of the theme clean and updatable without losing any changes.
(For creating a child-theme you will need to create at least a style.css [with a WordPress-specific comment, you can google] and a functions.php-file that needs a bit of php-code to enqueue the child-themes scripts and styles. The code for the functions.php can also be found by a quick google search. You then just place the style.css and the functions.php into a new folder you name in the pattern [foldername of your themes name]-child. You then place this folder next to the parent-themes folder in the "/wp-content/themes/"-directory.)
And here you go for the pagination: https://codex.wordpress.org/Pagination
I am creating a Wordpress custom theme, and I've been having issues with my woocommerce template rendering. Firstly, not all of the pages are showing up (some of them are reverting to the index.php and page.php files). Secondly, for the pages that are showing up (the single product page, the archive products page), the css is not being applied. I have tried everything suggested on the docs (hooks), but I have failed. Here is a link to my github for you to see the file structure.
https://github.com/naderae/elbe-collections
possible issues wuth my code:
my code is not written in the standard wordpress way. I only have three pages so far, index.php, page-about.php, and page-team.php, which work fine. page.php and single.php are empty. thus, my site consists of 2 pages, and index.php.
I've been struggling with this for 2 days, and would really appreciate some guidance of hoe to get me back on track. Cheers
Below is a list of some basic theme templates must preset in theme, more about this in details click here.
index.php
style.css
header.php
single.php
page.php
category.php
archive.php
404.php
I would recommend you to start with some default WordPress theme like twentyseventeen theme or other. These themes will have all basic functionality of WordPress. Check functions.php in the theme folder to customize/add functionality.
for more details about Template Hierarchy click here
Customize WooCommerce
Template structure & Overriding templates via a theme - link
Customizing WooCommerce - link
To overwrite woocommerce css you need to add a woocommerce folder to your theme. And go from there.
Woocommerce will also always use their own templates so the easiest way to change the layout is to use a child-plugin from woocommerce.
I am working out of wordpress, and I am using a plugin called a
theme switcher
This plugin allows me to use a different theme for a mobile device. That being said, other plugins like the {theme switcher} did NOT save my content.
Example.
I activated the desktop theme I selected for my mobile site, so i could make changes in the wordpress dashboard.
I edited the content (no custom code used) . I only used the wordpress appearance menu to edit this theme.
When I was done , I switch my theme back to my orignal website for my Desktop
All of the changes I made disappears off the mobile site, the color starts getting distorted, but when I switch my mane website back the
changes comeback.
That being said
Only way I knew to make a permanent edit to the files, was by going to the files directly in my file manager.
Directly in the themes folder that I chose for my mobile site.
How can I add a menu list to a theme's file?
The "menu include" is usually in the header.php file for your given theme. Look for something like the following:
<?php wp_nav_menu( $args ); ?>
If you replace this line with something like this, it will make your menu permanent and you will not be able to edit it in "Appearance > Menus":
<div id="menu">
<ul>
<li>Home</li>
<li>Yes</li>
<li>No</li>
</ul>
</div>
Fair warning that any theme updates will overwrite this header.php file. If you want to keep these changes, you will have to look into Child Themes.
I'm new to Woocommerce. I want to change the structure of the checkout page. Now I looked into the file "form-checkout". This is the right file?
In this file there is not much of the structure. I find many php actions. For example:
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
Where can I see the content of this action? So I can go in that file and change the structure?
P.S. Does anyone want to share more knowledge about Woocommerce with me?
There are several php files that make up the checkout page.
wp-content/plugins/woocommerce/templates/checkout/
cart-errors.php
form-billing.php
form-checkout.php
form-coupon.php
form-login.php
form-pay.php
form-shipping.php
review-order.php
thankyou.php
wp-content/plugins/woocommerce/templates/checkout/form-checkout.php is the main file.
It's recommended that you copy the template folder from the woocommerce plugin directory, put it at the root of your theme and rename it to woocommerce (leaving the template folder intact in the plugin directory to allow for upgrading).
I am currently working on a e-commerce site using wordpress and woocommerce and the theme The Retailer.
The theme does not have breadcrumbs links and now I have decided that I want to add them. From my understanding Woocommerce should have support for this.
I will enable the breadcrumbs links on the single-product.php page. The woocommerce documentation says that I should use <?php woo_breadcrumbs(); ?> function to enable the breadcrumb links.
But when I add the <?php woo_breadcrumbs(); ?> statement to my single-product.php page I get a fatal error saying that the function is undefined. My questions is how to make my child-theme "recognise" this function?
If I use "brute force" method and copy all the original woocommerce breadcrumbs code (found in: woocommerce/templates/global/breadcrumbs.php) to my own function inside my themes functions.php the breadcrumbs are working, although I do not get the delimiters and other things that should come with them...
This is not an elegant solution. Instead there must be some way for me to "register" the woocommerce breadcrumbs function inside my theme so that I can use the standard recommended woocommerce prodcedure. How would I do this?
Thank you for your help! Kind regards, Lukas
Here is solution that would work I guess:
Copy the "shop" folder to your theme from the below destination
wp-content\plugins\woocommerce\templates
And paste it inside your theme. I hope that will do the trick.
If your theme is woo-commerce ready, there is a file "theme-woocommerce.php" in includes folder; Thats were you can do the modification; You may want to create a child theme as well, in case you want to update your theme in a future