WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Issue with WooCommerce Shortcodes (2 posts)

  1. XavaIreland
    Member
    Posted 1 year ago #

    I have built a custom multi field search function and I am trying to populate the search results page with the product listing and the "Add To Cart" button.

    I have grabbed all items that match the search criteria and am using the following to build a list of items on the serach results page -

    if (is_array($searched_posts)){
    foreach ($searched_posts as $searched_post) {
    $post_id = $searched_post->ID;
    echo "<h1 class=\"entry-title\">ID) . "\">" . $searched_post->post_title . "</h1>";
    echo get_post_meta($searched_post->ID,'width',true) . "/";
    echo get_post_meta($searched_post->ID,'sidewall',true) . "R";
    echo get_post_meta($searched_post->ID,'radius',true) . "
    ";
    echo do_shortcode('[add_to_cart id=\"$post_id\"]');
    echo "ID) . "\">Read More";
    }
    }

    Unfortunately I can not get the shortcodes to work - any hints?

    http://wordpress.org/extend/plugins/woocommerce/

  2. XavaIreland
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic