/** * Add shortcode to make link to individual product */ add_shortcode('product_url', 'cc_product_url'); function cc_product_url($atts){ global $wpdb; if (empty( $atts )) { return ''; } if (isset( $atts['id'])) { $product_data = get_post($atts['id']); } else { return ''; } if ('product' !== $product_data->post_type) { return ''; } $_product = wc_get_product($product_data); return '