Forums

[resolved] WP eStore Shortcode Help (PHP required) (2 posts)

  1. cadencehart
    Member
    Posted 5 months ago #

    Hi! I'm a PHP newbie and I need assistance in modifying WP eStore shortcodes.

    Most of my posts' contents are displayed via Custom Fields. Therefore, I need to use the shortcodes in theme files. Now the problem is, a product ID needs to be specified for every add to cart button. The original code below is not dynamic so I have to call a custom field in every post that specifies the product ID. (Note: I only display one product per page).

    Code to add in theme is:
    <?php echo get_button_code_for_product(1); ?>

    The More Fields Plugin function to call the product id is
    <?php meta('id'); ?>

    How do I merge these two functions to correctly display the add to cart button?

    Thank you so much for the help!

  2. cadencehart
    Member
    Posted 5 months ago #

    Found the solution. Here it is:

    <?php $productkey = get_post_meta($post->ID, 'wp-product-id', true); ?>
    <?php echo get_button_code_for_product($productkey); ?>

Reply

You must log in to post.

About this Topic