Support » Plugin: CartHook for WooCommerce » Some new hooks

  • Geoffrey

    (@creativejuiz)


    Hello there,

    I would like to suggest you some new hooks that could be really helpful in our case, but maybe to other devs.

    In the method format_carthook_cart() it could be great to find a filterable $carthook_cart before the return, like that:

    
    $carthook_cart = apply_filters( 'carthook_woo_before_encode_cart', $carthook_cart );
    return json_encode( $carthook_cart );
    

    Same thing during the items population (the array) in the same function, some filters could be helpful :

    
    $carthook_cart['items'][] = array(
    	'imgUrl'        => apply_filters( 'carthook_woo_items_imgUrl', wp_get_attachment_url( $_product->get_image_id() ), $_product->id, $item ),
    	'url'           => apply_filters( 'carthook_woo_items_url', get_permalink( $_product->id ), $_product->id, $item ),
    	'name'          => apply_filters( 'carthook_woo_items_name', $_product->post->post_title, $_product->id, $item  ),
    	'eachItemCost'  => apply_filters( 'carthook_woo_items_eachItemCost', strval( $eachItemCost ), $_product->id, $item ),
    	'totalItemCost' => apply_filters( 'carthook_woo_items_totalItemCost', strval( $totalItemCost ), $_product->id, $item )
    );
    

    Just some ideas that could help developers in specific cases 🙂
    Thanks you in advance.

  • The topic ‘Some new hooks’ is closed to new replies.