add on mechandize

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 10 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9571

    Hi great plugin just wondering what would be the best way to add on mechanise say a t-shirt into the booking form ..at piont of sale
    – does it play well with other ecommerce pluggins like woo commerce?

    or is it easer to hard code that into the booking form with html.. pic of t-shirt> size : select button – price.. how would I add an extra fixed cost object into that form.. mm

    wolf wolf
    #9595

    Hi Wolf,
    Glad you like the plug-in.

    Currently you could create several tickets (with/without t-shirt) with different prices, and add t-shirt size field option (although this option would still appear to those not selecting the with t-shirt ticket).

    If you were to go down the manual HTML route (though I wouldn’t recommend it) you could use the ‘HTML’ form field, which allows arbitrary HTML to be added to the booking form. Or the ‘hook’ field which triggers a particular action (allowing you to hook onto that with a callback function).

    To adjust the booking total you could use the eventorganiser_pre_gateway_checkout_paypal filter, which filters the ‘cart’ that is sent to PayPal. Additionally you could adjust the booking amount using the filter eventorganiser_get_booking_meta_booking_amount (this adjusts what is seen on the bookings page / e-mails etc).

    To give you an idea of how to alter the cart sent to PayPal

    function my_alter_paypal_cart( $cart, $booking ){
        //$booking is an array. $booking['booking_id'] contains the booking ID
        /*
        $cart is of the form:
        $cart = array(
             'return' => //return url
             'item_name_0' => //Ticket name,
             'amount_0' => //Ticket price
             'quantity_0' => //Ticket quantity,
             'item_name_1' => //Ticket name (second ticket type),
             'amount_1' => //Ticket price (second ticket type),
             'quantity_1' => //Ticket quantity (second ticket type),
            ....
             'custom' => //custom data as query variables. e.g. booking_id=X&event_id=Y...
        );
        */
        //Adjust $cart and return it        
        return $cart;
    }
    add_filter( 'eventorganiser_pre_gateway_checkout_paypal', 'my_alter_paypal_cart', 5, 2 );

    Each ticket type being purchased appears as a separate item, and there’s no limit to the number of ticket types there could be. You would need to add another item after them with a name (e.g. “T-shirt”), price and quantity (1, probably).

    As you can see its not for the faint-hearted :).

    “Priced fields” (booking form fields which adjust the price of the booking) are on the road map – though there is currently no ETA for this feature.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.