Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tjhole/7705499 to your computer and use it in GitHub Desktop.
Save tjhole/7705499 to your computer and use it in GitHub Desktop.
WORDPRESS: Ultra Simple Paypal Cart Parse Shortcode
<?php if( get_field('the_price') ) {
$price = get_field('the_price');
echo '<div id="price">$' . $price . '</div>';
} ?>
<?php if( get_field('the_colors') ) {
$colors = implode('|', get_field('the_colors'));
<?php $title = get_the_title(); ?>
<?php
if ( function_exists('print_wp_cart_button_for_product') && $price && $colors) {
echo apply_filters( 'the_content', '[wp_cart:' . $title . ':price:' . $price . ':var1[Color|' . $colors .']:end]' );
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment