How can I add the cost of goods to the products programatically?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #90007
    Neil
    Participant

    Hello, Congratulation your website and plugin are awesome and just bought it ! I was going to buy the official plugin but the support was really bad, here it’s a lot better.

    I want to add programmatically the cost of good to product, do i just need to add to the product meta alg_wc_cog_order_cost my cost of good and it’s going to appear in the analytics ?

    thank you!

    #90008
    Pablo
    Moderator
    Plugin Support

    Thanks Neil, for the kind words 🙂

    You need to use the meta _alg_wc_cog_cost for your products. The meta _alg_wc_cog_order_cost is for orders.

    After updating the product cost it won’t appear in the analytics automatically. Each order item needs to have a cost too. You can do that manually by visiting each admin order and setting the value yourself or you can use our Tools & Reports > Orders Tools > Recalculate for orders with no costs.

    Then, you’ll need to enable the analytics options you want from our Tools & Reports > Analytics section. If our data doesn’t show up there you can try to clear the Analytics cache at WooCommerce > Status > Tools > Clear analytics cache.

    Let me know if it helps.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.