Productpage as Homepage
By default WC creates a page called “Shop”. That is the “catch all” products page.
So if you want to make that your homepage. You can simply go to your settings->reading and set your frontpage displays on “Shop” in the dropdown menu.
Tnx for your quick reply.
But i mean a single productpage. not the “catch all”
Well when you say productpage, it usually mean shop page…You should have said single products page.
The only way I can think of that may work is use htaccess file to redirect to your single products page on load…
Why do you want your homepage to show a single products page though? Do you only sell one item?
its a kind of Deal site. I want the active deal (product) as Homepage.
Or…you can create a page and put the shortcode of the product on the page. That will generate the detail of that product. And set that as your frontpage per the settings I mentioned above.
i have tried that, but the shortcode dont include the add to cart option.
For the add to cart button.
Or if that still doesn’t work for you. You make a duplicate of your index.php and name it home.php. Then open up the WC single products template and copy the code from that file and pasted it in your home.php replacing the loop that was once in there.
Put your settings->reading frontpage back to default which is nothing selected. WordPress will now use your home.php template when your site first loads.
Of course you will need to adjust the code abit so it will pull in the product that you want but shouldn’t be too hard.
If this is all too much for you to do, then I would suggest you have a developer to help you do it.
Or you can do something like this..
$product = get_product( $product_id );
$product is an object that contains all information and methods you need to generate the single products information. You can put this in the home.php replacing the loop.
That code dont show the add to cart + Price.
i am gonna try to edit the home.php
my single-product.php from my theme have the following code:
<?php /** * The Template for displaying all single products. * * Override this template by copying it to yourtheme/woocommerce/single-product.php * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ remove_action( 'woocommerce_before_main_content', 'yit_shop_page_meta' ); add_action( 'yit_before_content', 'yit_shop_page_meta' ); get_header('shop'); wp_enqueue_script( 'jquery-elastislider' ); wp_enqueue_script( 'jquery-tipTip' ); ?> <?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb - 20 */ do_action('woocommerce_before_main_content'); ?> <div itemscope itemtype="http://schema.org/Product" id="product-<?php the_ID(); ?>" <?php post_class(); ?>> <?php while ( have_posts() ) : the_post(); ?> <?php woocommerce_get_template_part( 'content', 'single-product' ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #product-<?php the_ID(); ?> --> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content) */ do_action('woocommerce_after_main_content'); ?> <?php /** * woocommerce_sidebar hook * * @hooked woocommerce_get_sidebar - 10 */ do_action('woocommerce_sidebar'); ?> <?php get_footer('shop'); ?>
maybe you have a idea what to edit 😀
- The topic ‘Productpage as Homepage’ is closed to new replies.