Function Reference: geodir_payment_cart_id
Summary
This function has not been documented yet.
Filters
‘geodir_payment_cart_id’ [Line: 4354]
Source Code
function geodir_payment_cart_id( $invoice_id = '' ) {
global $gd_session;
$user_ID = get_current_user_id();
if ( !$user_ID ) {
geodir_payment_clear_cart();
return NULL;
}
if ( $invoice_id > 0 ) {
$gd_session->set('gd_cart_id', $invoice_id);
}
$cart_id = (int)$gd_session->get('gd_cart_id');
$cart_info = $cart_id > 0 ? geodir_get_invoice( $cart_id ) : NULL;
if ( empty( $cart_info ) ) {
geodir_payment_clear_cart();
return NULL;
}
if ( $user_ID != $cart_info->user_id ) {
geodir_payment_clear_cart();
return NULL;
}
$cart_id = apply_filters( 'geodir_payment_cart_id', $cart_id, $invoice_id );
return $cart_id;
}