Forum Replies Created

Viewing 15 replies - 406 through 420 (of 494 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    Hi seank123,

    To add additional fee to the Cart Total, you could use woocommerce_after_calculate_totals something like this

    note: you should remove woocommerce_before_calculate_totals first

    function calculate_cart_total( $cart_object ) {
    	/* additional price that has to be added */
    	$additionalPrice = 20;	
    
    	foreach ( $cart_object->cart_contents as $key => $value ) {
    		/* Check for the value ( or it could be any condition logic ) */
    		if( isset( $value['wccpf_new_logo_upload'] ) && $value['wccpf_new_logo_upload'] == "yes" ) {
    			//Update the Cart Grand Total
    			$cart_object->cart_contents_total += $additionalPrice;
    		}
    	}
    }
    add_action( 'woocommerce_after_calculate_totals', 'calculate_cart_total' );
    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, the fix is ready, I am preparing for the next release. will be available soon.

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, currently it’s not supported, but this feature is in my road map, I will make it available ASAP.

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi are you seeing any error in Console Log ( Chrome Dev Tool ) while updating fields meta .?

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, sure I will include this with my next release, probably within a week you can expect.

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, which version of WC Fields Factory are you using.? as far as I know themes doesn’t have anything to do with this. If you still thinks that this could be of theme problem, try to activate different theme and do your updates.

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, This issue is related to Validation Hook priority.

    WP_PLUGIN/wc-fields-factory/classes/product-form.php LN : 21

    Change that validation hook priority value from 1 to 99. like this

    add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'validate_wccpf' ), 99, 2 );

    I will update this with my next release

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, this option is under progress, will be available with my next release.

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, you could do something like this

    add_filter( 'woocommerce_add_to_cart_validation', 'validate_field', 10, 2 );
    function validate_field( $passed, $pid = null ) {
    	$res = true;
    	if( isset( $pid ) ) {
    		$all_fields = apply_filters( 'wccpf/load/all_fields', $pid );
    		foreach ( $all_fields as $fields ) {
    			foreach ( $fields as $field ) {
    				if( $field["name"] == "your_field_name" && isset( $_REQUEST[ $field["name"] ] ) ) {
    					$val = $_REQUEST[ $field["name"] ];
    					if( $val != "M" || $val != "F" ) {
    						$res = false;
    					}
    				}
    			}
    			if( !$res ) {
    				wc_add_notice( 'Validation Failed', 'error' );
    			}
    		}
    	}
    	return $res;
    }
    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi danomurray, thanks for raising this.

    That would be great if all values remains even after a validation failed.
    Yes it is possible. I will try to include on my next release.

    ( I will try to give you quick update, if got time )

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi,

    I switch Display on Cart & Checkout to No but upon save the value to Yes

    Does it worked.?

    Regarding that Date picker issue, are you using V1.2.4 .? because it’s been fixed on that version.

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, thanks for reporting this.

    I actually tested only for Simple & Variable products. I will test it for grouped as well and try to fix it. will add this to my check list and try to release with the next update.

    Regards
    Sark

    Plugin Author Saravana Kumar K

    (@mycholan)

    Here is the updated snippet.

    function calculate_cart_total( $cart_object ) {
        foreach ( $cart_object->cart_contents as $key => $value ) {
            $all_fields = apply_filters( 'wccpf/load/all_fields', $product_id );
            foreach ( $all_fields as $fields ) {
                foreach ( $fields as $field ) {
                    if( $field["name"] == "donation_amount" ) {
                        $fvalue = $value['wccpf_unique_key'].$field["name"];
                        //change the price
                        $value['data']->price = $fvalue;
                    }
                }
            }
        }
    }
    add_action( 'woocommerce_before_calculate_totals', 'calculate_cart_total', 1, 1 );

    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, If I understand correctly, you wanted to display custom fields values to Order Archive Page itself right.?

    You can do some thing like this

    add_filter( 'manage_edit-shop_order_columns', 'my_custom_column_handler' );
    function my_custom_column_handler( $columns ){
    	$new_columns = ( is_array( $columns ) ) ? $columns : array();
    	unset( $new_columns['order_actions'] );
    	$new_columns['custom_column'] = 'CUstom Column';
    	$new_columns['order_actions'] = $columns['order_actions'];
    	return $new_columns;
    }
    
    add_action( 'manage_shop_order_posts_custom_column', 'my_custom_column_value_handler', 2 );
    function my_custom_column_value_handler( $column ){
    	global $post;
    
    	if( $column == "custom_column" ) {
    		// Loop through your order line items & display whatever custom fields you want
    		// using wc_get_order_item_meta( $item_id, $key );
    	}
    }
    Plugin Author Saravana Kumar K

    (@mycholan)

    Hi sorry for the delayed response.

    Here is the complete css class, which you can use to customize the flook & feels of the fields created by WC Fields Factory.

    body.woocommerce table.wccpf_fields_table { }
    body.woocommerce table.wccpf_fields_table td { }
    body.woocommerce table.wccpf_fields_table td.wccpf_label { }
    body.woocommerce table.wccpf_fields_table td.wccpf_value { }
    body.woocommerce table.wccpf_fields_table td.wccpf_label label { }
    body.woocommerce table.wccpf_fields_table td.wccpf_value input[type=text],
    body.woocommerce table.wccpf_fields_table td.wccpf_value input[type=email],
    body.woocommerce table.wccpf_fields_table td.wccpf_value input[type=number],
    body.woocommerce table.wccpf_fields_table td.wccpf_value select { }

Viewing 15 replies - 406 through 420 (of 494 total)