So basically I have several pages with Woocommerce products listed in them (same products in Page 1 and Page 2) . What I have to do is basically open up different form based on which page the product was clicked on.
Example:
I open 1st page width products and click on product -> Form nr 1 Opens I open 2nd page with products and click on product -> Form nr 2 Opens
Any ideas how to approach this problem? Don't know which direction to even look.
You can add a content filter to detect the page and amend the content of it.
add_filter( 'the_content', 'my_content_filter' );
function gwp_ec_content_filter ($content)
{
global $post;
if ($post->ID == $page1_page_id)
{
// Change $content
} else if ($post->ID == $page2_page_id)
{
// Change $content
}
}
Or if you doing this inside a theme page template, then
global $post;
if ($post->ID == $page1_page_id)
{
// open form 1
} else if ($post->ID == $page2_page_id)
{
// open form 2
}