Skip to content

Instantly share code, notes, and snippets.

@tjhole
Created November 29, 2013 14:09
Show Gist options
  • Save tjhole/7706212 to your computer and use it in GitHub Desktop.
Save tjhole/7706212 to your computer and use it in GitHub Desktop.
ACF: Shipping Repeter to Ultra Simple WP Cart
<?php $price = get_field('price');
$title = get_the_title();
$shipping_row = get_field('shipping_costs');
$shipping_total = count($shipping_row);
$i = 0;
foreach($shipping_row as $ship){
$i++;
$shipping_output.= $ship['area'] . ',' . $ship['cost'];
if ($i!=$shipping_total) {$shipping_output.= "|";}
};
echo apply_filters( 'the_content', '[wp_cart:' . $title . ':price:' . $price . ':shipping:[Shipping|' . $shipping_output .']:end]' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment