Custom template for woocommerce - php

How can I customize the layout of the WooCommerce single product page template in my WordPress theme?
I have tried to create new template file in child theme, but that couldn't help it.

Related

Get related Products in the WooCommerce widget Sidebar

Does anyone have any idea how you can put related products in the sidebar in WooCommerce?
Something like in this screenshot:
1) You can use this code to enable Shortcode execution in the text widget
// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
2) Then in Wordpress widget, you will able to add and use the text widget adding to it:
[related_products per_page="4" columns="1"]
But you will have to make some custom CSS for it, to get the display that you want… Or to build your own custom widget (or shortcode).

Wordpress sidebar doesn't load on product attributes archive woocommerce

I am building an e-commerce store on Wordpress using Woocommerce.
I have created a sidebar with filters etc. that work fine on normal category and shop archives.
Working sidebar image
.
The problem is that when I go to an attributes archive (e.g. /brand/xxxx) the sidebar does not load.
Not working sidebar image
.
I have tried creating a product attribute template in the /woocommerce directory by creating a taxonomy-pa_brand.php file but that did not fix it.

custom widget including both theme n plugin?

Looking forward adding page attributes to woocommerce product page as my website WordPress picks up default sidebar or custom sidebar of responsive theme. so how can I have custom widget on product page which includes woocommerce widgets n not default page widgets of theme.
Install WooSidebars plugin by Woothemes
In Admin panel, go to Appearance/Widget Areas, then create your custom widgets.
Kindly check image which explains well

Use default WooCommerce Gallery

My WooCommerce theme has a custom gallery that is coded directly into single-product.php. Rather than using this custom gallery, I wish to display images on the product screen with the original default Woo Commerce gallery.
The files in the plugin that I believe display the default gallery are:
product-image.php
product-thumbnails.php
I'm new to server side programming and PHP. I've tried the following code:
<?php wc_get_template_part( 'content', 'product-images' ); ?>
<?php wc_get_template_part( 'content', 'product-thumbnails' ); ?>
But this doesn't return anything.
How do revert to the original WooCommerce gallery when my theme has an image gallery hard coded into single.php?
In your case it seems that your theme has custom woocommerce templates files inside it. The trick could be trying replace some of those templates files, by the original ones. The better way to do that is to set a child theme, avoiding theme updates problems…
1) If you are using a child theme:
Copy the woocommerce folder located in your parent theme to your child theme.
Replace from the woocommerce plugin, templates folder, the needed templates files to the woocommerce folder inside your active child theme.
2) If you are not using a child theme, Just replace from the woocommerce plugin, templates folder, the needed templates files to the woocommerce folder inside your active theme.
Reference: Overriding Templates via a Theme

WordPress redux framework - Add custom fiedl to post type from child theme

I have a WordPress theme with a few post types, the theme runs on redux framework.
I want to add to a specific post type a custom field from the functions.php file in child theme without editing core files/installing plugins for it.
How could i do it? looking for something like:
if(is_post_type("some_post_type")&& is_admin_single_editor()){
// Add custom field to edit screen
}
Thanks

Categories