this might be a very stupid question but I want to know how to do it and if its possible. Is there a way to hook(embed) woo-commerce product page into a plain php site? I know I WooCommerce is a WP plugin but is there a way just taking the product or cart page of WooCommerce and display it in plain php?
Rather than using iframe is there any other way?
Edit: Will be using WP to install the plugin but display the products into a none-WP page just say product.php.
You need to include wp-load.php
. Supposing this PHP file is at the root of a WordPress installation:
<?php
define( 'WP_USE_THEMES', false );
require( $_SERVER['DOCUMENT_ROOT'] .'/wp-load.php' );
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<title><?php bloginfo( 'name' ); ?></title>
<?php
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<div id="primary">
<div id="content" role="main">
<?php echo do_shortcode( '[recent_products per_page="12" columns="4"]' ); ?>
</div>
</div>
<?php get_footer(); ?>
I've added a simplified version of the theme header.php
in this example, but footer.php
is being called by get_footer();
. Check WooCommerce shortcodes.