Skip to content

Instantly share code, notes, and snippets.

@FranciscoHV
Created April 13, 2016 17:59
Show Gist options
  • Save FranciscoHV/27fc12786fc422f20223b5f53cdbca6b to your computer and use it in GitHub Desktop.
Save FranciscoHV/27fc12786fc422f20223b5f53cdbca6b to your computer and use it in GitHub Desktop.
product id x course id
---------------------bp-course-functions.php
global $post;
$val=5839;
$return ='<div class="course_details">
<ul>';
// $product_id = $post->ID;
?><div align=\"center\"><? $return .= do_shortcode('[product_sale id = "'.$val.'"]'); ?></div><?
global $wp_query, $post;
$post = get_post(5839);
setup_postdata($post);
$wp_query->post = $post;
$wscd = new WSCD();
$wscd->single_product();
wp_reset_postdata();
$wp_query->post = $post;
// echo the_ID();
// echo $product_id;
foreach($course_details as $course_detail){
if(isset($course_detail) && strlen($course_detail) > 5)
$return .=$course_detail;
}
$return .= '</ul>
</div>';
return apply_filters('wplms_course_front_details',$return);
}
.....................................................feature.php
// add_action('woocommerce_order_status_completed','bp_course_enable_access');
// function bp_course_enable_access($order_id){
// $order = new WC_Order( $order_id );
// $items = $order->get_items();
// $user_id=$order->user_id;
// $order_total = $order->get_total();
// $commission_array=array();
// foreach($items as $item_id=>$item){
// $courses=get_post_meta($item['product_id'],'vibe_courses',true);
// $product_id = apply_filters('bp_course_product_id',$item['product_id'],$item);
// $subscribed=get_post_meta($product_id,'vibe_subscription',true);
// //$meta .= $product_id;
// }
// }
//$product_id = apply_filters('bp_course_product_id',$item['product_id'],$item);
// $courses=get_post_meta($item['product_id'],'vibe_courses',true);
// $product_id = apply_filters('bp_course_product_id',$item['product_id'],$item);
//$meta .=$product_id
//$meta .=bp_course_product_id(array($item['product_id']));
// $meta .= bp_course_product_id(array('id'=>$custom_post->ID));
// $return .= do_shortcode('[product_sale id = "5839"]');
// echo $meta;
// echo $product_id;
// echo $courses;
@FranciscoHV
Copy link
Author

`$order = new WC_Order( $order_id );
$items = $order->get_items();

foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment