$value ) { $post_meta[ $key ] = is_serialized( $value[0] ) ? unserialize( $value[0] ) : $value[0]; } extract( $post_meta['twoco_payment_type'] ); extract( $post_meta['twoco_amount'] ); extract( $post_meta['twoco_others'] ); if ( $amount_type == 'fixed' ) { $hidden = "display:none;"; $btn_label = str_replace( '%%amount%%', "{$amount}", esc_html( $btn_label ) ); } else{ $flex = "display: flex;gap:10px;"; $min_max = "min='{$min_amount}' max='{$max_amount}'"; $amount = ''; $btn_label = str_replace( '%%amount%%', "", esc_html( $btn_label ) ); } $_cart = [ 'id' => $form_id, 'name' => get_the_title( $form_id ), 'price' => $amount, 'quantity' => 1 ]; if ( $payment_type == 'subscription' ) { $_cart['recurrence'] = [ 'unit' => strtoupper( $period_unit ), 'length' => $period_time, ]; $_cart['duration'] = [ 'unit' => strtoupper( $period_unit ), 'length' => $period_time, ]; $_cart['renewalPrice'] = (float)$amount; } $cart[] = $_cart; $custom_fields = ''; if ( isset( $enable_custom_field ) && $enable_custom_field == 'on' ) { $fields = [ [ // 'id' => 'field_1', 'label' => 'Field 1', 'type' => 'text', ], [ 'id' => 'field_2', 'label' => 'Field 2', 'type' => 'number', ], [ 'id' => 'field_3', 'label' => 'Field 3', 'type' => 'email', ], ]; $custom_fields = twoco_generate_html( $fields ); } $cart = json_encode( $cart ); $redirect_url = add_query_arg( 'form_id', $form_id, get_the_permalink() ); if ( isset( $_GET['form_id'] ) && isset( $_GET['refno'] ) && $success_page != '' && $_GET['form_id'] == $form_id ) { $script = ""; } echo "
{$custom_fields}
{$currency}
{$script}"; ?>