plugin development - Duplicate shipping method logic to another shipping method

admin2025-06-05  4

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

I have a plugin that adds additional shipping method with some intricate logic to it that adds specific checkout fields with API-generated values etc.

The thing is that I need variation of this shipping method (like free delivery in certain conditions certain amount etc).

Is it possible to somehow create a class that inherits this custom shipping method with all its intricate logic or do it otherwise without having to clone the entire plugin folder and adjusting plugin name etc?

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

I have a plugin that adds additional shipping method with some intricate logic to it that adds specific checkout fields with API-generated values etc.

The thing is that I need variation of this shipping method (like free delivery in certain conditions certain amount etc).

Is it possible to somehow create a class that inherits this custom shipping method with all its intricate logic or do it otherwise without having to clone the entire plugin folder and adjusting plugin name etc?

Share Improve this question asked Dec 14, 2018 at 14:59 user2361user2361 1012 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I see 2 options here:

  • Create a new plugin (copying the old one) and modify it as you need
  • With just one plugin, create multiple shipping methods. Remember that you can call the add_rate() method multiple times inside one shipping class.

As a shipping plugins developer, what I do is using the second option for each variant of a carrier. For example if we are using DHL, with one plugin and within the same class, you can add shipping options for DHL Express shipping and DHL Standard shipping. You don't need multiple classes for this.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749098976a316353.html

最新回复(0)