Hi,
I need a simple script for WHMCS to calculate shipping costs. To do this job you need to know the basics of WHMCS. Below the project description.
I will include one field in which user has to enter the Zip code once a product is added to cart. I can use Product Custom Fields to do this.
Then the script needs to calculate the weight of product(s) added in the cart. For do this, I will have a SQL table with: product ID and its corresponding weight. The script needs to verify the products in the cart based on their ID and calculate their total weight (for each product added in cart) making the query in SQL table.
Once I know the total weight, I will query the second SQL table that will have: Zipcode, Weight and Cost. Here is very simple, I just need to check the cost based on the zipcode and the weight of the product(s).
This cost will be add to the Total Amount in cart (can be done using hook CartTotalAdjust).
Table #1
Col1: ProductID
Col2: Weight
Table #2
Col1: Zipcode
Col2: Weight
Col2: Cost
So, the requirements are:
1. Custom field of every Product will be created by me.
2. Create a Hook file which calculates the Price based on "Weight & Zip code" on "CartTotalAdjustment" .
3. Once Zip code is entered, run the Hook file.
4. Then, Script will first obtain the Product weight through Product ID in Table 1 and then based on Weight and Zip code, it will calculate the Total Cost and adjust it with the Product price.