WooCommerce - excelling eCommerce
Adding new product type and limiting payment methods by product type (3 posts)

  1. mybadstudios
    Posted 1 year ago #


    I am not entirely new to WP but I am completely new to any form of payment processing as well as WooCommerce. I am using WooCommerce on my site, though, and people I have spoken with say that WOO is super easy to mod so I figured I'd integrate what I need to do with WOO but when I looked at all the stuff that it exposes to me I was both excited and completely overwhelmed... I am thus asking for any assistance in making this ocean of new stuff make more sense, please...

    So here is what I want to do: I want to have a store in which you can buy real world goods like t-shirts and baseball caps and those items can be bought with real world cash (i.e. PayPal etc). I also want to sell digital goods like 3D models and soundtracks etc which should also be purchasable via real world cash. So far so good.

    then I also want to sell virtual items that they never ever download but which gets added to their inventory on my database. These items, though, should be made available for purchase using either real world cash or my own virtual currency hosted and managed exclusively by me.

    So basically, what I am needing is a way to specify a new payment method 'myMarketPlace' that will only show up when viewing items under a certain category in the shop. If the items in their cart contain both virtual items and other items, the option should be gone also.

    I have already found code to create a new payment gateway and, as expected, when you know what to do then extending WOO is super simple but for me who doesn't know it... it would have taken me ages to figure that out! Anyway, now I need to make that payment option only show up in some cases and not others. I am assuming I should just hook into X, then scan through the item in the cart and if condition Y, remove my gateway from an array. Great. What is X and what what is the name of the array?

    But most importantly! And this is the part I am desperate for you to help me with, please... How do I make WOO send the order to my own server instead of sending it off to paypal or whoever to do the processing of the order? I can wrote my own code to manage my own database and update their balances and update their inventories and what not but how do I make WOO send me the data and not send it elsewhere? And finally, how do I complete the transaction so WOO doesn't leave the state as pending or something else?

    I noticed there is a variety of item types already including virtual items but I am yet to find out what the differences are between the lot. Perhaps this can be used for what I want to do? If so, a link to that document would be most welcome indeed!!!

    So, to summarise my requirements:
    - Real world payment methods as well as a virtual currency payment method
    - Virtual currency should only be available for purchases of virtual items
    - The store can contain physical, digital and virtual goods

    Any insights would be greatly appreciated!

    Thanks in advance


  2. mybadstudios
    Posted 1 year ago #

    p.s. I forgot to mention... One of the big differences between my payment method and the normal woo stuff is that when you buy items using my payment method, the user should not receive any kind of download links to items since there is nothing to download. All purchases will go straight into their inventory and they can see it from there.

    This payment method is to be used on more than just websites and will be required to, at times, send out plain text responses (without any header info like in normal html) so in that respect (like it not even needing to go to a 'completed' page afterwards or show a 'transaction successful' message of any kind but just respond with a code like 3 or 9 etc make me think that the existing product types will not be suitable to what I need to do which is why I asked about how to create a new one...

    Thanks again

  3. mybadstudios
    Posted 1 year ago #

    Ah, I found the page that explains the product types...

    Normal is for the physical goods
    Normal + downloadable is for my digital goods
    Normal + downloadable + virtual can be used for what I want to do.

    Ideally digital goods would also be virtual but if adding a new field (like postprocess_locally)/product type (internal_update) would be too much of a stretch, this is acceptable. So the main question now is how to make the transaction give me control at the point where the "Pay" button is pressed so I can manually adjust their balances and stock levels?

    Products can have additional tags so I suppose just adding "postprocess_locally" and setting it to true for each product might actually work and avoid having to create a new product type so, although it is going to be a shlep to add that to each of the products manually, it could work... so half the battle is already won...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic